1# Your Makefile should include this Makefile after defining: 2# TOOLBASE - the base filename for files with .h & .cpp versions 3# SRCONLY - any cpp files without headers. 4# HDRONLY - any header files without cpp 5# VERSION - if not version in Makefile.include 6 7MAKEFILES_PATH := $(dir $(lastword $(MAKEFILE_LIST))) 8 9OBJDIR = obj 10include $(MAKEFILES_PATH)Makefile.common 11 12HEADERS=$(TOOLHDR) 13 14 15 16.PHONY: all test clean debug profile param install specific_clean $(STAT_GEN_LIB) $(STAT_GEN_LIB_DEBUG) $(STAT_GEN_LIB_PROFILE) 17 18# make everything, ensure headers are in the include direcotry. 19opt debug profile : $(addprefix $(INCLUDE_PATH)/, $(HEADERS)) 20 21install: opt 22 23# Link into the include directory 24$(INCLUDE_PATH)/%.h: %.h 25 -ln -s ../$(DIR_NAME)/$< $@ 26 27 28######### 29# Build the library 30opt: $(STAT_GEN_LIB_OPT) 31debug: $(STAT_GEN_LIB_DEBUG) 32profile: $(STAT_GEN_LIB_PROFILE) 33 34# To build the library, build the objects 35# Then add them to the library 36$(STAT_GEN_LIB_OPT): $(OBJECTS_OPT) 37 ar -cr $@ $(OBJECTS_OPT) 38$(STAT_GEN_LIB_DEBUG): $(OBJECTS_DEBUG) 39 ar -cr $@ $(OBJECTS_DEBUG) 40$(STAT_GEN_LIB_PROFILE): $(OBJECTS_PROFILE) 41 ar -cr $@ $(OBJECTS_PROFILE) 42 43UNAME=$(shell uname) 44 45ifeq ($(UNAME), Darwin) 46specific_clean: 47 -rm -f $(addprefix $(INCLUDE_PATH)/, $(HEADERS)) 48 -$(AR) d $(STAT_GEN_LIB_OPT) $(OBJECTS_OPT) 49 -$(RANLIB) $(STAT_GEN_LIB_OPT) 50 -$(AR) d $(STAT_GEN_LIB_DEBUG) $(OBJECTS_DEBUG) 51 -$(RANLIB) $(STAT_GEN_LIB_DEBUG) 52 -$(AR) d $(STAT_GEN_LIB_PROFILE) $(OBJECTS_PROFILE) 53 -$(RANLIB) $(STAT_GEN_LIB_PROFILE) 54else 55specific_clean: 56 -rm -f $(addprefix $(INCLUDE_PATH)/, $(HEADERS)) 57 $(AR) d $(STAT_GEN_LIB_OPT) $(OBJECTS_OPT) 58 $(RANLIB) $(STAT_GEN_LIB_OPT) 59 $(AR) d $(STAT_GEN_LIB_DEBUG) $(OBJECTS_DEBUG) 60 $(RANLIB) $(STAT_GEN_LIB_DEBUG) 61 $(AR) d $(STAT_GEN_LIB_PROFILE) $(OBJECTS_PROFILE) 62 $(RANLIB) $(STAT_GEN_LIB_PROFILE) 63endif 64