summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorGravatar Jonas Gunz <himself@jonasgunz.de> 2019-03-20 18:36:49 +0100
committerGravatar Jonas Gunz <himself@jonasgunz.de> 2019-03-20 18:36:49 +0100
commit28719acc7e73e4ed44af3a40aae06d61ba4da8a5 (patch)
tree8dc38edefb3b6e8b64c98f770b58afd613ff1135 /Makefile
parentb1d1a78775ec913fb2b62c77ac56c47d8011f425 (diff)
downloadtermgl-28719acc7e73e4ed44af3a40aae06d61ba4da8a5.tar.gz
Makefile tweaks
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile16
1 files changed, 11 insertions, 5 deletions
diff --git a/Makefile b/Makefile
index f4a7633..e1fa110 100644
--- a/Makefile
+++ b/Makefile
@@ -5,13 +5,18 @@ LDFLAGS = -shared
SONAME = engine
BUILDDIR = build
SOURCEDIR = src
+OBJECTDIR = obj
TESTSOURCE = test
#VERSION
VERSION = 0
PATCHLEVEL = 4
OUTPUT = lib$(SONAME).so.$(VERSION).$(PATCHLEVEL)
-OBJ = cObject.o cObjectHandler.o cRender.o cInput.o cWiremesh.o
+SRCS=$(wildcard $(SOURCEDIR)/*.cpp)
+OBJS =$(SRCS:.cpp=.o)
+OBJ =$(OBJS:$(SOURCEDIR)/%=$(OBJECTDIR)/%)
+
+#OBJ = cObject.o cObjectHandler.o cRender.o cInput.o cWiremesh.o
build: dir genversion $(OBJ)
@echo [LD] $(OBJ)
@@ -22,16 +27,17 @@ build: dir genversion $(OBJ)
@cp $(SOURCEDIR)/version.h $(BUILDDIR)/inc
dir:
+ @mkdir -p $(OBJECTDIR)
@mkdir -p $(BUILDDIR)
@mkdir -p $(BUILDDIR)/lib
@mkdir -p $(BUILDDIR)/inc
-%.o: $(SOURCEDIR)/%.cpp
+$(OBJECTDIR)/%.o: $(SOURCEDIR)/%.cpp
@echo [CC] $<
- @$(CC) $(CFLAGS) -c $<
+ @$(CC) $(CFLAGS) -c $< -o $@
-%.o: example/%.cpp
+$(OBJECTDIR)/%.o: example/%.cpp
@echo [CC] $<
@$(CC) $(CFLAGS) -I$(SOURCEDIR) -c $<
@@ -59,7 +65,7 @@ genversion:
@echo "#define BUILDER \"`git config user.name`\"" >> $(SOURCEDIR)/version.h
@echo "#define BUILDERMAIL \"`git config user.email`\"" >> $(SOURCEDIR)/version.h
-gentest: build $(TESTSOURCE).o
+gentest: build $(OBJECTDIR)/$(TESTSOURCE).o
@echo [LD] $(TESTSOURCE).o
@mkdir -p $(BUILDDIR)/test
@$(CC) $(DEBUGFLAGS) -o $(BUILDDIR)/test/test $(TESTSOURCE).o $(OBJ) -lstdc++ -lm