aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorGravatar Jonas Gunz <himself@jonasgunz.de> 2019-04-26 12:49:07 +0200
committerGravatar Jonas Gunz <himself@jonasgunz.de> 2019-04-26 12:49:07 +0200
commit055dba2c1803a81027ce2cca96ae21a5b1b1fdb9 (patch)
tree8f00c9234cd0e22fb06bd41cbda5f9b452606c23 /Makefile
parentfb70c64aee30c427024090b0e798cf23c98877b5 (diff)
downloadtermgl-055dba2c1803a81027ce2cca96ae21a5b1b1fdb9.tar.gz
Added Makefile DEBUG target
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile23
1 files changed, 12 insertions, 11 deletions
diff --git a/Makefile b/Makefile
index d44724c..e5111ef 100644
--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,5 @@
CC = clang
-CFLAGS = -Wall -g -std=c++11 -fPIC
-DEBUGFLAGS = -Wall -g -std=c++11
+CFLAGS = -Wall -std=c++11 -fPIC
LDFLAGS = -shared
SONAME = termgl
BUILDDIR = build
@@ -19,7 +18,7 @@ OBJ =$(OBJS:$(SOURCEDIR)/%=$(OBJECTDIR)/%)
#OBJ = cObject.o cObjectHandler.o cRender.o cInput.o cWiremesh.o
build: dir genversion $(OBJ)
- @echo [LD] $(OBJ)
+ @echo [ LD ] $(OBJ)
@$(CC) $(CFLAGS) -o $(BUILDDIR)/lib/$(OUTPUT) $(OBJ) $(LDFLAGS) -Wl,-soname=lib$(SONAME).so.$(VERSION)
@ln -sf $(OUTPUT) $(BUILDDIR)/lib/lib$(SONAME).so.$(VERSION)
@ln -sf $(OUTPUT) $(BUILDDIR)/lib/lib$(SONAME).so
@@ -32,13 +31,15 @@ dir:
@mkdir -p $(BUILDDIR)/lib
@mkdir -p $(BUILDDIR)/inc
+debug: CFLAGS += -g -D _DEBUG
+debug: build;
$(OBJECTDIR)/%.o: $(SOURCEDIR)/%.cpp
- @echo [CC] $<
+ @echo [ CC ] $<
@$(CC) $(CFLAGS) -c $< -o $@
$(OBJECTDIR)/%.o: example/%.cpp
- @echo [CC] $<
+ @echo [ CC ] $<
@$(CC) $(CFLAGS) -I$(SOURCEDIR) -c $<
@@ -47,15 +48,15 @@ all: clean build
.PHONY: clean doc
clean:
- @echo [RM] $(OBJ)
- @echo [RM] $(TESTSOURCE).o
- @echo [RM] src/version.h
- @echo [RM] $(BUILDDIR)/lib $(BUILDDIR)/inc $(BUILDDIR)/test doc/
+ @echo [ RM ] $(OBJ)
+ @echo [ RM ] $(TESTSOURCE).o
+ @echo [ RM ] src/version.h
+ @echo [ RM ] $(BUILDDIR)/lib $(BUILDDIR)/inc $(BUILDDIR)/test doc/
@rm -df $(OBJ) $(TESTSOURCE).o src/version.h
@rm -Rdf $(BUILDDIR)/lib $(BUILDDIR)/inc $(BUILDDIR)/test doc/
genversion:
- @echo [GEN] version.h
+ @echo [GEN ] version.h
@echo "#pragma once" > $(SOURCEDIR)/version.h
@echo "#define VERSION $(VERSION)" >> $(SOURCEDIR)/version.h
@echo "#define PATCHLEVEL $(PATCHLEVEL)" >> $(SOURCEDIR)/version.h
@@ -66,7 +67,7 @@ genversion:
@echo "#define BUILDERMAIL \"`git config user.email`\"" >> $(SOURCEDIR)/version.h
gentest: build $(OBJECTDIR)/$(TESTSOURCE).o
- @echo [LD] $(TESTSOURCE).o
+ @echo [ LD ] $(TESTSOURCE).o
@mkdir -p $(BUILDDIR)/test
@$(CC) $(DEBUGFLAGS) -o $(BUILDDIR)/test/test $(TESTSOURCE).o $(OBJ) -lstdc++ -lm