Skip to content

Commit

Permalink
Makefiles: reorder, and use version support for macos
Browse files Browse the repository at this point in the history
  • Loading branch information
pjotrp committed Nov 9, 2017
1 parent 554e1f6 commit 04e8eab
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 11 deletions.
19 changes: 9 additions & 10 deletions Makefile
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
6 changes: 5 additions & 1 deletion Makefile.macosx
Expand Up @@ -89,14 +89,17 @@ 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
OBJS = $(SOURCES:.cpp=.o)

all: $(OUTPUT)

./src/version.h:
./scripts/gen_version_info.sh > src/version.h

<print-% : ; @echo $* = $($*)

$(OUTPUT): $(OBJS)
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 04e8eab

Please sign in to comment.