aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPjotr Prins2017-11-09 08:55:52 +0000
committerPjotr Prins2017-11-09 08:55:52 +0000
commit04e8eab1c328b008c70308eebd9c6b12932ec2b5 (patch)
treedbaeb01a60fc91ae13b0db69fe9937b83e8cab21
parent554e1f69f8453a0f7c4f4ed2fe180dcf12a3a679 (diff)
downloadpangemma-04e8eab1c328b008c70308eebd9c6b12932ec2b5.tar.gz
Makefiles: reorder, and use version support for macos
-rw-r--r--Makefile19
-rw-r--r--Makefile.macosx6
2 files changed, 14 insertions, 11 deletions
diff --git a/Makefile b/Makefile
index 2d91a49..3287654 100644
--- a/Makefile
+++ b/Makefile
@@ -104,10 +104,6 @@ endif
OUTPUT = $(BIN_DIR)/gemma
-SOURCES = $(SRC_DIR)/main.cpp
-
-HDR =
-
# Detailed libary paths, D for dynamic and S for static
LIBS_LNX_D_LAPACK = -llapack
@@ -140,22 +136,25 @@ SOURCES = $(wildcard src/*.cpp)
# all
OBJS = $(SOURCES:.cpp=.o)
+all: $(OUTPUT)
+
./src/version.h:
./scripts/gen_version_info.sh > src/version.h
-all: ./src/version.h $(OUTPUT)
-
$(OUTPUT): $(OBJS)
$(CPP) $(CPPFLAGS) $(OBJS) $(LIBS) -o $(OUTPUT)
-$(OBJS) : $(HDR)
+$(OBJS): $(HDR)
+
+# .cpp.o:
+# $(CPP) $(CPPFLAGS) -c $*.cpp -o $*.o
-.cpp.o:
- $(CPP) $(CPPFLAGS) $(HEADERS) -c $*.cpp -o $*.o
.SUFFIXES : .cpp .c .o $(SUFFIXES)
-unittests: all contrib/catch-1.9.7/catch.hpp $(TEST_SRC_DIR)/unittests-main.o $(TEST_SRC_DIR)/unittests-math.o
+./bin/unittests-gemma: contrib/catch-1.9.7/catch.hpp $(TEST_SRC_DIR)/unittests-main.o $(TEST_SRC_DIR)/unittests-math.o $(OBJS)
$(CPP) $(CPPFLAGS) $(TEST_SRC_DIR)/unittests-main.o $(TEST_SRC_DIR)/unittests-math.o $(filter-out src/main.o, $(OBJS)) $(LIBS) -o ./bin/unittests-gemma
+
+unittests: ./bin/unittests-gemma
./bin/unittests-gemma
fast-check: all unittests
diff --git a/Makefile.macosx b/Makefile.macosx
index 079d2b9..fa7460e 100644
--- a/Makefile.macosx
+++ b/Makefile.macosx
@@ -89,7 +89,7 @@ LIBS += -framework Accelerate \
/usr/local/Cellar/gsl/2.4/lib/libgsl.a \
/usr/local/Cellar/gsl/2.4/lib/libgslcblas.a
-HDR = $(wildcard src/*.h)
+HDR = $(wildcard src/*.h) ./src/version.h
SOURCES = $(wildcard src/*.cpp)
# all
@@ -97,6 +97,9 @@ OBJS = $(SOURCES:.cpp=.o)
all: $(OUTPUT)
+./src/version.h:
+ ./scripts/gen_version_info.sh > src/version.h
+
<print-% : ; @echo $* = $($*)
$(OUTPUT): $(OBJS)
@@ -132,6 +135,7 @@ check: fast-check slow-check
check-all: check lengthy-check
clean:
+ rm -vf $(SRC_DIR)/version.h
rm -vf $(SRC_DIR)/*.o
rm -vf $(SRC_DIR)/*~
rm -vf $(TEST_SRC_DIR)/*.o