Commit 2efc29e5 authored by phlo's avatar phlo

updated Makefiles

parent 8456b1b1
*.o
*.d
*.bkp
*.swp
wiki
......@@ -6,9 +6,6 @@ CXXFLAGS = $(CFLAGS) $(WFLAGS)
WFLAGS = -pedantic -Wall -Wextra -Wundef -Wformat=2 -Wmissing-include-dirs -Wswitch-default -Wunused -Wuninitialized -Wshadow -Wcast-qual -Wcast-align -Wold-style-cast -Wdisabled-optimization -Wredundant-decls -Wstrict-overflow -Wsign-conversion -Werror
LDFLAGS =
# additional command definitions
RM = rm -rf
# source files (excluding main.cc)
SRC = instructionset.cc \
schedule.cc \
......@@ -22,9 +19,6 @@ SRC = instructionset.cc \
solver.cc \
boolector.cc
# header files
# HEADER = $(subst .cc,.hh,$(SRC))
# object files
OBJ = $(subst .cc,.o,$(SRC))
......@@ -52,7 +46,7 @@ $(MAIN): $(OBJ) main.cc
.PHONY: clean
clean:
$(MAKE) -C test clean
$(RM) *.o *.dSYM $(MAIN)
-rm -rf *.o *.dSYM $(MAIN)
# find trailing whitespaces
.PHONY: trim
......@@ -64,13 +58,12 @@ trim:
flags:
@echo $(CXXFLAGS)
# export compiler flags for sub-make
export CXX CXXFLAGS OBJ
# auto-dependency generation
include dependencies.mk
# export compiler flags for sub-make
# export CXX CFLAGS DEPDIR DEPFLAGS POSTCOMPILE OBJ MAIN SRC
export CXX CFLAGS OBJ MAIN SRC
# demo #########################################################################
# program files
......
# auto-dependency generation
#
# see http://make.mad-scientist.net/papers/advanced-auto-dependency-generation/#combine
DEPFLAGS = -MT $@ -MMD -MP -MF $*.d
MAKE_C = $(CC) $(DEPFLAGS) $(CFLAGS) $(CXXFLAGS) -c $<
MAKE_CXX = $(CXX) $(DEPFLAGS) $(CXXFLAGS) -c $<
%.o: %.c
%.o: %.c %.d
$(MAKE_C)
%.o: %.cc
%.o: %.cc %.d
$(MAKE_CXX)
%.o: %.cpp
%.o: %.cpp %.d
$(MAKE_CXX)
%.o: %.cxx
%.o: %.cxx %.d
$(MAKE_CXX)
%.d: ;
.PRECIOUS: %.d
include $(wildcard *.d)
# NOTE: depends on exported variables by parent Makefile
# - CFLAGS
# - CXX
# - CXXFLAGS
# - OBJ
# - MAIN
# googletest root
GTEST_DIR = lib/googletest/googletest
......@@ -10,15 +10,11 @@ GTEST_DIR = lib/googletest/googletest
GTEST_LIB = $(GTEST_DIR)/make/gtest-all.o
# compiler flags (exported from parent makefile)
CXXFLAGS = $(CFLAGS) \
$(WFLAGS) \
-isystem $(GTEST_DIR)/include \
-I../ \
-pthread \
-D__TEST__
# compiler warnings
WFLAGS = -pedantic -Wall -Wextra
CXXFLAGS := $(CXXFLAGS) \
-isystem $(GTEST_DIR)/include \
-I../ \
-pthread \
-D__TEST__
# object files of code to test (exported)
OBJ := $(addprefix ../,$(OBJ))
......@@ -36,6 +32,7 @@ TEST_MAIN := main_gtest.cc
TEST_RUN := run_all_tests
# run all tests
.PHONY: run
run: $(TEST_RUN)
./$(TEST_RUN) --gtest_filter=-*verify*
......@@ -48,14 +45,14 @@ $(GTEST_LIB):
make -C $(dir $(GTEST_LIB)) $(notdir $(GTEST_LIB))
# delete generated files
.PHONY: clean
clean:
-rm -rf *.o *.dSYM $(TEST_RUN)
# delete generated files and libraries
.PHONY: clean-all
clean-all: clean
make -C $(dir $(GTEST_LIB)) clean
# auto-dependency generation
include ../dependencies.mk
.PHONY: run clean clean-all
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment