summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorGravatar Jonas Gunz <himself@jonasgunz.de> 2019-05-05 22:58:14 +0200
committerGravatar Jonas Gunz <himself@jonasgunz.de> 2019-05-05 22:58:14 +0200
commit3fec03eeaa7dbe5152255ebdc0aae9841c241565 (patch)
tree5a7a082794384b67195ab3ffc3ef0e1a592930c7 /Makefile
parentff41e663c541b5e5e7cbb4eb85b96b8dc2b766ad (diff)
downloadtermgl-3fec03eeaa7dbe5152255ebdc0aae9841c241565.tar.gz
Makefile fixing
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile54
1 files changed, 28 insertions, 26 deletions
diff --git a/Makefile b/Makefile
index e5111ef..b13428f 100644
--- a/Makefile
+++ b/Makefile
@@ -1,25 +1,25 @@
-CC = clang
-CFLAGS = -Wall -std=c++11 -fPIC
-LDFLAGS = -shared
-SONAME = termgl
-BUILDDIR = build
-SOURCEDIR = src
-OBJECTDIR = obj
-TESTSOURCE = test
-#VERSION
-VERSION = 1
-PATCHLEVEL = 0
-OUTPUT = lib$(SONAME).so.$(VERSION).$(PATCHLEVEL)
+CC = clang
+CPPFLAGS = -Wall -std=c++11 -fPIC
+LDFLAGS = -shared
+SONAME = termgl
+
+BUILDDIR = build
+SOURCEDIR = src
+OBJECTDIR = obj
+TESTSOURCE = test
+OUTPUT = lib$(SONAME).so.$(VERSION).$(PATCHLEVEL)
-SRCS=$(wildcard $(SOURCEDIR)/*.cpp)
-OBJS =$(SRCS:.cpp=.o)
-OBJ =$(OBJS:$(SOURCEDIR)/%=$(OBJECTDIR)/%)
+#VERSION
+VERSION = 1
+PATCHLEVEL = 0
-#OBJ = cObject.o cObjectHandler.o cRender.o cInput.o cWiremesh.o
+SRCS = $(wildcard $(SOURCEDIR)/*.cpp)
+OBJS = $(SRCS:.cpp=.o)
+OBJ = $(OBJS:$(SOURCEDIR)/%=$(OBJECTDIR)/%)
-build: dir genversion $(OBJ)
- @echo [ LD ] $(OBJ)
- @$(CC) $(CFLAGS) -o $(BUILDDIR)/lib/$(OUTPUT) $(OBJ) $(LDFLAGS) -Wl,-soname=lib$(SONAME).so.$(VERSION)
+build: dir genversion $(OBJ)
+ @echo [LD] $(OBJ)
+ @$(CC) $(CPPFLAGS) -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
@cp $(SOURCEDIR)/c*.h $(BUILDDIR)/inc
@@ -35,13 +35,15 @@ debug: CFLAGS += -g -D _DEBUG
debug: build;
$(OBJECTDIR)/%.o: $(SOURCEDIR)/%.cpp
- @echo [ CC ] $<
- @$(CC) $(CFLAGS) -c $< -o $@
+ @echo [CC] $<
+ @$(CC) $(CPPFLAGS) -c $< -o $@
$(OBJECTDIR)/%.o: example/%.cpp
- @echo [ CC ] $<
- @$(CC) $(CFLAGS) -I$(SOURCEDIR) -c $<
+ @echo [CC] $<
+ @$(CC) $(CPPFLAGS) -I$(SOURCEDIR) -c $<
+debug: CPPFLAGS+=-g
+debug: build
all: clean build
@@ -66,10 +68,10 @@ genversion:
@echo "#define BUILDER \"`git config user.name`\"" >> $(SOURCEDIR)/version.h
@echo "#define BUILDERMAIL \"`git config user.email`\"" >> $(SOURCEDIR)/version.h
-gentest: build $(OBJECTDIR)/$(TESTSOURCE).o
- @echo [ LD ] $(TESTSOURCE).o
+gentest: debug $(OBJECTDIR)/$(TESTSOURCE).o
+ @echo [LD] $(TESTSOURCE).o
@mkdir -p $(BUILDDIR)/test
- @$(CC) $(DEBUGFLAGS) -o $(BUILDDIR)/test/test $(TESTSOURCE).o $(OBJ) -lstdc++ -lm
+ @$(CC) $(CPPFLAGS) -g -o $(BUILDDIR)/test/test $(TESTSOURCE).o $(OBJ) -lstdc++ -lm
run: gentest
@./$(BUILDDIR)/test/test