dsrc isn't necessary for this repo
[client-tools.git] / src / external / 3rd / library / platform / utils / Base / solaris / Makefile
blob9f6bdfcd3a54d9c5c8ac72db39ad100320880066
1 # environment variables:
2 # $INCLUDE_PATH is a colon-delimited list of include directories
4 EMPTY_CHAR=
5 SPACE_CHAR=$(empty) $(empty)
6 COLON_CHAR=:
8 # # # # # # # # # # # # # # # # # # # # #
10 OUTPUT_FILE_ST=libBase.a
11 OUTPUT_FILE_MT=libBase_MT.a
12 OUTPUT_DIR=../../../lib
13 OBJECT_DIR_ST=./obj_st
14 OBJECT_DIR_MT=./obj_mt
16 INCLUDE_DIRS=.. ../
18 SOURCE_DIRS=. ..
19 SOURCE_FILES=
21 LIBRARY_DIRS=
22 LIBRARY_FILES=
24 CFLAGS_USER=
25 LFLAGS_USER=
27 # # # # # # # # # # # # # # # # # # # # #
29 INCLUDE_DIR_LIST=$(subst $(COLON_CHAR),$(SPACE_CHAR),$(INCLUDE_PATH)) $(INCLUDE_DIRS)
30 INCLUDE_FLAGS=$(addprefix -I,$(INCLUDE_DIR_LIST))
31 CFLAGS_ST=$(INCLUDE_FLAGS) $(CFLAGS_USER) -D_GNU_SOURCE -Wall -Wno-unknown-pragmas
32 CFLAGS_MT=$(INCLUDE_FLAGS) $(CFLAGS_USER) -D_GNU_SOURCE -D_REENTRANT -Wall -Wno-unknown-pragmas
33 CFLAGS_DEBUG_ST=$(CFLAGS_ST) -D_DEBUG -g
34 CFLAGS_RELEASE_ST=$(CFLAGS_ST) -DNDEBUG -O2
35 CFLAGS_DEBUG_MT=$(CFLAGS_MT) -D_DEBUG -g
36 CFLAGS_RELEASE_MT=$(CFLAGS_MT) -DNDEBUG -O2
38 LIBRARY_FLAGS=$(addprefix -l,$(LIBRARIES))
39 LFLAGS=$(LIBRARY_FLAGS) $(LFLAGS_USER) -r
40 LFLAGS_DEBUG=$(LFLAGS)
41 LFLAGS_RELEASE=$(LFLAGS)
43 CPP=g++
44 LINK=ld
46 # # # # # # # # # # # # # # # # # # # # #
48 DEBUG_OBJ_DIR_ST=$(OBJECT_DIR_ST)/debug
49 RELEASE_OBJ_DIR_ST=$(OBJECT_DIR_ST)/release
50 DEBUG_OBJ_DIR_MT=$(OBJECT_DIR_MT)/debug
51 RELEASE_OBJ_DIR_MT=$(OBJECT_DIR_MT)/release
53 DEBUG_DIR=$(OUTPUT_DIR)/debug
54 RELEASE_DIR=$(OUTPUT_DIR)/release
56 FIND=$(shell ls $(x)/*.cpp)
57 SOURCE_LIST = $(SOURCE_FILES) $(foreach x, $(SOURCE_DIRS), $(FIND))
59 DEBUG_OBJ_LIST_ST=$(addprefix $(DEBUG_OBJ_DIR_ST)/, $(notdir $(SOURCE_LIST:.cpp=.o)))
60 RELEASE_OBJ_LIST_ST=$(addprefix $(RELEASE_OBJ_DIR_ST)/, $(notdir $(SOURCE_LIST:.cpp=.o)))
61 DEBUG_OBJ_LIST_MT=$(addprefix $(DEBUG_OBJ_DIR_MT)/, $(notdir $(SOURCE_LIST:.cpp=.o)))
62 RELEASE_OBJ_LIST_MT=$(addprefix $(RELEASE_OBJ_DIR_MT)/, $(notdir $(SOURCE_LIST:.cpp=.o)))
64 # # # # # # # # # # # # # # # # # # # # #
66 release_st: echoRelease_st releaseDirs_st $(RELEASE_DIR)/$(OUTPUT_FILE_ST)
67 @echo Successfully built $(RELEASE_DIR)/$(OUTPUT_FILE_ST)
68 @echo
70 debug_st: debugDirs_st $(DEBUG_DIR)/$(OUTPUT_FILE_ST)
71 @echo Successfully built $(DEBUG_DIR)/$(OUTPUT_FILE_ST)
72 @echo
74 release_mt: echoRelease_mt releaseDirs_mt $(RELEASE_DIR)/$(OUTPUT_FILE_MT)
75 @echo Successfully built $(RELEASE_DIR)/$(OUTPUT_FILE_MT)
76 @echo
78 debug_mt: debugDirs_mt $(DEBUG_DIR)/$(OUTPUT_FILE_MT)
79 @echo Successfully built $(DEBUG_DIR)/$(OUTPUT_FILE_MT)
80 @echo
82 all: clean debug_st release_st debug_mt release_mt
84 all_st: clean debug_st release_st
86 all_mt: clean debug_mt release_mt
88 # # # # # # # # # # # # # # # # # # # # #
90 debugDirs_st :
91 @mkdir -p $(DEBUG_OBJ_DIR_ST)
92 @mkdir -p $(DEBUG_DIR)
94 $(DEBUG_OBJ_DIR_ST)/%.o : $(filter %/$(notdir $(basename $@)).cpp,$(SOURCE_LIST))
95 $(CPP) $(CFLAGS_DEBUG_ST) -o $@ -c $(filter %/$(notdir $(basename $@)).cpp,$(SOURCE_LIST))
97 $(DEBUG_DIR)/$(OUTPUT_FILE_ST): $(DEBUG_OBJ_LIST_ST)
98 $(LINK) $(LFLAGS_DEBUG) -o $@ $(DEBUG_OBJ_LIST_ST)
101 debugDirs_mt :
102 @mkdir -p $(DEBUG_OBJ_DIR_MT)
103 @mkdir -p $(DEBUG_DIR)
105 $(DEBUG_OBJ_DIR_MT)/%.o : $(filter %/$(notdir $(basename $@)).cpp,$(SOURCE_LIST))
106 $(CPP) $(CFLAGS_DEBUG_MT) -o $@ -c $(filter %/$(notdir $(basename $@)).cpp,$(SOURCE_LIST))
108 $(DEBUG_DIR)/$(OUTPUT_FILE_MT): $(DEBUG_OBJ_LIST_MT)
109 $(LINK) $(LFLAGS_DEBUG) -o $@ $(DEBUG_OBJ_LIST_MT)
112 # # # # # # # # # # # # # # # # # # # # #
114 echoRelease_st :
115 @echo Building $(OUTPUT_FILE_ST)
116 @echo compiler: $(CPP) $(CFLAGS_RELEASE_ST)
117 @echo linker: $(LINK) $(LFLAGS_RELEASE)
118 @echo
120 echoRelease_mt :
121 @echo Building $(OUTPUT_FILE_MT)
122 @echo compiler: $(CPP) $(CFLAGS_RELEASE_MT)
123 @echo linker: $(LINK) $(LFLAGS_RELEASE)
124 @echo
127 # # # # # # # # # # # # # # # # # # # # #
129 releaseDirs_st :
130 @mkdir -p $(RELEASE_OBJ_DIR_ST)
131 @mkdir -p $(RELEASE_DIR)
133 $(RELEASE_OBJ_DIR_ST)/%.o : $(filter %/$(notdir $(basename $@)).cpp,$(SOURCE_LIST))
134 @echo compiling $(filter %/$(notdir $(basename $@)).cpp,$(SOURCE_LIST))
135 @$(CPP) $(CFLAGS_RELEASE_ST) -o $@ -c $(filter %/$(notdir $(basename $@)).cpp,$(SOURCE_LIST))
137 $(RELEASE_DIR)/$(OUTPUT_FILE_ST): $(RELEASE_OBJ_LIST_ST)
138 @echo linking $(RELEASE_DIR)/$(OUTPUT_FILE_ST)
139 @$(LINK) $(LFLAGS_RELEASE) -o $@ $(RELEASE_OBJ_LIST_ST)
141 releaseDirs_mt :
142 @mkdir -p $(RELEASE_OBJ_DIR_MT)
143 @mkdir -p $(RELEASE_DIR)
145 $(RELEASE_OBJ_DIR_MT)/%.o : $(filter %/$(notdir $(basename $@)).cpp,$(SOURCE_LIST))
146 @echo compiling $(filter %/$(notdir $(basename $@)).cpp,$(SOURCE_LIST))
147 @$(CPP) $(CFLAGS_RELEASE_MT) -o $@ -c $(filter %/$(notdir $(basename $@)).cpp,$(SOURCE_LIST))
149 $(RELEASE_DIR)/$(OUTPUT_FILE_MT): $(RELEASE_OBJ_LIST_MT)
150 @echo linking $(RELEASE_DIR)/$(OUTPUT_FILE_MT)
151 @$(LINK) $(LFLAGS_RELEASE) -o $@ $(RELEASE_OBJ_LIST_MT)
154 # # # # # # # # # # # # # # # # # # # # #
156 clean:
157 @echo removing "$(OBJECT_DIR_ST)/*.o"
158 @rm -rf $(OBJECT_DIR_ST)
159 @echo removing "$(OBJECT_DIR_MT)/*.o"
160 @rm -rf $(OBJECT_DIR_MT)
161 @echo removing $(DEBUG_DIR)/$(OUTPUT_FILE_ST)
162 @rm -f $(DEBUG_DIR)/$(OUTPUT_FILE_ST)
163 @echo removing $(RELEASE_DIR)/$(OUTPUT_FILE_ST)
164 @rm -f $(RELEASE_DIR)/$(OUTPUT_FILE_ST)
165 @echo removing $(DEBUG_DIR)/$(OUTPUT_FILE_MT)
166 @rm -f $(DEBUG_DIR)/$(OUTPUT_FILE_MT)
167 @echo removing $(RELEASE_DIR)/$(OUTPUT_FILE_MT)
168 @rm -f $(RELEASE_DIR)/$(OUTPUT_FILE_MT)
169 @echo