missing project/build files
[client-tools.git] / src / engine / build / shared_unix / library.mak
blob9cf7d2efb17d824c1474eff6ca1df31922092993
1 #This makefile assumes that defs.mak is already included by the project specific makefile
3 ifeq ($(VERBOSE_BUILD),)
4 V =@
5 else
6 V =
7 endif
9 ifeq ($(W_ERROR),)
10 W_ERROR=-Werror
11 endif
13 ifeq ($(STATIC_LIB),)
14 CUSTOM_CPP_FLAGS += -fPIC
15 CUSTOM_LINK_FLAGS = -shared
17 DYN_LINK = -lc
18 DEBUG_OUTPUT = lib$(LIBRARY).so.0.0
19 LINK_FLAGS = $(CUSTOM_LINK_FLAGS)
20 DEBUG_SYM_LINK = $(V)cd $(SHARED_DEBUG_LIB_PATH) && ln -sf ../../../../src/compile/linux/$(LIBRARY)/debug/$(DEBUG_OUTPUT) lib$(LIBRARY).so
22 ifeq ($(BULLSEYE_BUILD),)
23 LINK = g++
24 else
25 LINK = /opt/app/bullseyecoverage/bin/g++
26 endif
28 else
29 CUSTOM_LINK_FLAGS =
30 DYN_LINK =
31 CUSTOM_CPP_FLAGS =
32 DEBUG_OUTPUT = lib$(LIBRARY)_d.a
33 LINK_FLAGS = -r -static
34 DEBUG_SYM_LINK =
35 LINK = ld
36 endif
39 INCLUDE_DIRS_FINAL =$(INCLUDE_DIRS) $(STL_INCLUDE_PATH) /usr/include /usr/include/libxml2
41 SHARED_SRC_LIST =$(shell find $$PWD/../../src/shared -name "*.cpp")
42 PLATFORM_SRC_LIST =$(shell [ -d $$PWD/../../src/$(PLATFORM) ] && find ../../src/$(PLATFORM) -name "*.cpp")
43 SRC_LIST =$(SHARED_SRC_LIST) $(PLATFORM_SRC_LIST) $(CUSTOM_SRC_LIST)
44 DEPENDENCY_LIST = $(SRC_LIST:.cpp=.d)
46 DEBUG_OUTPUT_DIR = $(BOOTPRINT_LIB_PATH)/$(LIBRARY)/debug
48 DEBUG_OBJ_LIST = $(addprefix $(DEBUG_OUTPUT_DIR)/, $(notdir $(SRC_LIST:.cpp=.o)))
49 CPP_FLAGS_DEBUG = -g $(addprefix -I,$(INCLUDE_DIRS_FINAL)) $(PLATFORM_DEFINES) $(CUSTOM_CPP_FLAGS) -D_REENTRANT -D_XOPEN_SOUCE=500 -D_GNU_SOURCE -DUSING_STL -D_DEBUG -D__STL_NO_BAD_ALLOC -Wall -Wno-unknown-pragmas $(W_ERROR) -Wno-ctor-dtor-privacy -Wformat -Wreturn-type -Wimplicit -ftemplate-depth-25
50 #LINK_FLAGS = -r $(CUSTOM_LINK_FLAGS) #for .so libs you need -shared
51 #DEBUG_OUTPUT = lib$(LIBRARY)_d.a
53 RELEASE_OUTPUT_DIR = $(BOOTPRINT_LIB_PATH)/$(LIBRARY)/release
54 RELEASE_OBJ_LIST = $(addprefix $(RELEASE_OUTPUT_DIR)/, $(notdir $(SRC_LIST:.cpp=.o)))
55 CPP_FLAGS_RELEASE = -g -O2 $(addprefix -I,$(INCLUDE_DIRS_FINAL)) -Wno-ctor-dtor-privacy $(PLATFORM_DEFINES) -D__STL_NO_BAD_ALLOC -D_REENTRANT -D_XOPEN_SOUCE=500 -D_GNU_SOURCE $(CUSTOM_CPP_FLAGS) -Wno-unknown-pragmas -DUSING_STL
56 RELEASE_OUTPUT = lib$(LIBRARY)_r.a
58 LINT_SCRIPT = $(BOOTPRINT_SRC_PATH)/../tools/swglint.sh
59 LINT_TARGETS = $(addsuffix .lint,$(SRC_LIST))
60 .PHONY : release
63 %.cpp.lint : %.cpp
64 @echo prerequisite: $(subst .lint,,$@)
65 @echo output: $@
66 $(LINT_SCRIPT) $(subst .lint,,$@)
67 touch $@
69 all : debug release tags
71 publish:
73 lint: $(LINT_TARGETS)
75 $(LINT_TARGETS): $(SRC_LIST)
76 $(LINT_SCRIPT) $(subst .lint,,$@)
77 touch $@
79 debug: debug_custom_step
80 +$(V)$(MAKE) $(SHARED_DEBUG_LIB_PATH)/$(DEBUG_OUTPUT)
82 $(SHARED_DEBUG_LIB_PATH):
83 $(V)mkdir -p $(SHARED_DEBUG_LIB_PATH)
85 $(SHARED_DEBUG_LIB_PATH)/$(DEBUG_OUTPUT): $(SHARED_DEBUG_LIB_PATH) $(DEBUG_OUTPUT_DIR)/$(DEBUG_OUTPUT)
87 $(DEBUG_OUTPUT_DIR):
88 $(V)mkdir -p $(DEBUG_OUTPUT_DIR)
90 $(DEBUG_OBJ_LIST):
91 @echo $(notdir $(basename $@)).cpp
92 $(V)$(CPP) $(CPP_FLAGS_DEBUG) -o $@ -c $(filter %/$(notdir $(basename $@)).cpp,$(SRC_LIST))
94 $(DEBUG_OUTPUT_DIR)/$(DEBUG_OUTPUT): $(DEBUG_OUTPUT_DIR) $(DEBUG_OBJ_LIST)
95 @echo Creating debug library $@
96 $(V)$(LINK) $(LINK_FLAGS) -o $(DEBUG_OUTPUT_DIR)/$(DEBUG_OUTPUT) $(DYN_LINK) $(DEBUG_OBJ_LIST)
97 $(DEBUG_SYM_LINK)
99 ifneq ($(MAKECMDGOALS),clean)
100 ifneq ($(MAKECMDGOALS),depend)
101 include .depend
102 endif
103 endif
105 .PHONY : $(DEPENDENCY_LIST)
107 #depend: .depend $(DEPENDENCY_LIST)
108 # $(V)perl $(BOOTPRINT_SRC_PATH)/../tools/programmer/linux/dependcat.pl $(DEPENDENCY_LIST) > .depend
109 # $(V)rm $(DEPENDENCY_LIST)
111 depend: .depend $(DEPENDENCY_LIST)
112 $(V)perl $(BOOTPRINT_SRC_PATH)/../tools/dependcat.pl $(DEPENDENCY_LIST) > .depend
113 $(V)rm $(DEPENDENCY_LIST)
115 .depend:
116 touch .depend
117 +make depend_custom_step
118 +make depend
120 $(DEPENDENCY_LIST):
121 @echo Generating dependencies for $(notdir $(@:.d=.cpp))
122 @echo -n $(DEBUG_OUTPUT_DIR)/ >> $@
123 $(V)$(CPP) $(PLATFORM_DEFINES) $(CPP_FLAGS_RELEASE) -MM $(addprefix -I,$(INCLUDE_DIRS_FINAL)) $(@:.d=.cpp)>> $@
125 clean: custom_clean_step
126 touch .depend
127 rm -Rf $(DEBUG_OUTPUT_DIR)
128 rm -f .depend
130 #Create emacs Tags for source files for easy browsing
131 tags : $(SRC_LIST)
132 @mkdir -p Tags
133 @etags $(SRC_LIST)
134 @mv -f TAGS Tags