annotate branches/carfac_cpp/makefile @ 706:f8e90b5d85fd tip

Delete CARFAC code from this repository. It has been moved to https://github.com/google/carfac Please email me with your github username to get access. I've also created a new mailing list to discuss CARFAC development: https://groups.google.com/forum/#!forum/carfac-dev
author ronw@google.com
date Thu, 18 Jul 2013 20:56:51 +0000
parents 186972c88472
children
rev   line source
Ulf@564 1 # How to use:
Ulf@564 2 # Add your cpp code to the list in UNITS.
Ulf@564 3 #
Ulf@564 4 # Unit test:
Ulf@564 5 # If you want to add a test build target for that cpp file ONLY, please see
Ulf@564 6 # example "AGC_unittest". (no need to add explicit build rule)
Ulf@564 7 #
Ulf@564 8 # If you intend to test a class including instanciated members, you need to
Ulf@564 9 # make a explicit rule to link properly. See example "CARFAC_unittest".
Ulf@564 10
Ulf@585 11 # settings
Ulf@585 12 GTEST_DIR = ../../../googletest
Ulf@585 13 LIB_EXTENSION = .dll
Ulf@585 14 EXE_EXTENSION = .exe
Ulf@585 15 # end settings
Ulf@585 16
Ulf@564 17 SRC_HEADERDIR = include
Ulf@564 18 SRC_DIR = src
Ulf@564 19 SRC_TESTDIR = unittest
Ulf@564 20
Ulf@564 21 SRC_HEADERS = $(SRC_HEADERDIR)/*.h
Ulf@564 22
Ulf@564 23 CPPFLAGS += -I$(SRC_HEADERDIR) -I$(GTEST_DIR)/include
Ulf@564 24 CXXFLAGS += -g -Wall -Wextra -std=gnu++0x #IMPORTANT note gnu++0x
Ulf@564 25
Ulf@587 26 UNITS = CARFAC AGC CAR Ear IHC unit_conversion #Add build units here (without the .cpp)
Ulf@564 27 SRC_OBJ = $(addprefix $(SRC_DIR)/, $(addsuffix .o, $(UNITS)))
Ulf@564 28
Ulf@564 29 GTEST_HEADERS = $(GTEST_DIR)/include/gtest/*.h \
Ulf@564 30 $(GTEST_DIR)/include/gtest/internal/*.h
Ulf@564 31
Ulf@564 32 GTEST_SRCS_ = $(GTEST_DIR)/src/*.cc $(GTEST_DIR)/src/*.h $(GTEST_HEADERS)
Ulf@564 33
Ulf@585 34 all : libcarfac unittest
Ulf@585 35
Ulf@585 36 libcarfac : $(SRC_DIR)/CARFAC.o $(SRC_OBJ)
Ulf@586 37 $(CXX) -shared $(CPPFLAGS) $(CXXFLAGS) -lpthread $^ -o $@$(LIB_EXTENSION) -fPIC
Ulf@585 38
Ulf@585 39 example_program : libcarfac
Ulf@585 40 # likely some example executable that runs the whole thing...
Ulf@585 41
Ulf@587 42 unittest: $(foreach unit, $(UNITS), $(addsuffix _unittest, $(unit)))
Ulf@585 43 $(foreach binary, $^, ./$(addsuffix $(EXE_EXTENSION), $(binary));)
Ulf@585 44
Ulf@587 45 CARFAC_unittest : $(SRC_OBJ)
Ulf@587 46 CAR_unittest : $(SRC_OBJ) #$(SRC_DIR)/unit_conversion.o
Ulf@587 47 Ear_unittest : $(SRC_OBJ)
Ulf@564 48
Ulf@588 49 cleanup :
Ulf@588 50 rm -f *.o *.a src/*.o unittest/*.o
Ulf@588 51
Ulf@588 52 clean : cleanup
Ulf@588 53 rm -f *.dll *.exe
Ulf@564 54
Ulf@564 55 # pattern magic
Ulf@564 56 $(SRC_DIR)/%.o : %.cpp $(SRC_HEADERS) #normal source
Ulf@585 57 $(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $(.SOURCE)
Ulf@564 58
Ulf@564 59 $(SRC_TESTDIR)/%.o : %.cpp $(SRC_HEADERS) $(GTEST_HEADERS) # unittest
Ulf@585 60 $(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $(.SOURCE)
Ulf@564 61
Ulf@564 62 %_unittest : $(SRC_DIR)/%.o $(SRC_TESTDIR)/%_unittest.o gtest_main.a #unittest
Ulf@585 63 $(CXX) $(CPPFLAGS) $(CXXFLAGS) -lpthread $^ -o $@
Ulf@564 64 # end pattern magic
Ulf@564 65
Ulf@564 66 # gtest stuff
Ulf@564 67 gtest-all.o : $(GTEST_SRCS_)
Ulf@585 68 $(CXX) $(CPPFLAGS) -I$(GTEST_DIR) $(CXXFLAGS) -c \
Ulf@585 69 $(GTEST_DIR)/src/gtest-all.cc
Ulf@564 70
Ulf@564 71 gtest_main.o : $(GTEST_SRCS_)
Ulf@585 72 $(CXX) $(CPPFLAGS) -I$(GTEST_DIR) $(CXXFLAGS) -c \
Ulf@585 73 $(GTEST_DIR)/src/gtest_main.cc
Ulf@564 74
Ulf@564 75 gtest.a : gtest-all.o
Ulf@585 76 $(AR) $(ARFLAGS) $@ $^
Ulf@564 77
Ulf@564 78 gtest_main.a : gtest-all.o gtest_main.o
Ulf@585 79 $(AR) $(ARFLAGS) $@ $^
Ulf@564 80 # end gtest stuff