1 #This makefile assumes that defs.mak is already included by the project specific makefile
3 ifeq ($(VERBOSE_BUILD
),)
14 CUSTOM_CPP_FLAGS
+= -fPIC
15 CUSTOM_LINK_FLAGS
= -shared
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
),)
25 LINK
= /opt
/app
/bullseyecoverage
/bin
/g
++
32 DEBUG_OUTPUT
= lib
$(LIBRARY
)_d.a
33 LINK_FLAGS
= -r
-static
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
))
64 @echo prerequisite
: $(subst .lint
,,$@
)
66 $(LINT_SCRIPT
) $(subst .lint
,,$@
)
69 all : debug release
tags
75 $(LINT_TARGETS
): $(SRC_LIST
)
76 $(LINT_SCRIPT
) $(subst .lint
,,$@
)
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
)
88 $(V
)mkdir
-p
$(DEBUG_OUTPUT_DIR
)
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
)
99 ifneq ($(MAKECMDGOALS
),clean)
100 ifneq ($(MAKECMDGOALS
),depend
)
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
)
117 +make depend_custom_step
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
127 rm -Rf
$(DEBUG_OUTPUT_DIR
)
130 #Create emacs Tags for source files for easy browsing