STRIP =
WARN_MSG =
else
-STRIP = -s
+STRIP = -Wl,-x
WARN_MSG = "(without symbols) "
endif
# Compile a c file, don't link...
CompileC := $(CC) -c $(CPPFLAGS) $(CCFLAGS) $(CompileCommonOpts)
CompileCG := $(CompileC) -g -D_DEBUG
-CompileCO := $(CompileC) -O3 -DNDEBUG -finline-functions -felide-constructors -fshort-enums ## DISABLE -freg-struct-return because of gcc3.2 bug
+CompileCO := $(CompileC) -O3 -DNDEBUG -finline-functions -fshort-enums ## DISABLE -freg-struct-return because of gcc3.2 bug
CompileCP := $(CompileCO) $(PROFILE)
else
Link := $(CXX)
endif
-LinkG := $(Link) -g -L $(LIBDEBUG) $(STRIP)
-LinkO := $(Link) -O3 -L $(LIBRELEASE)
-LinkP := $(Link) -O3 -L $(LIBPROFILE) $(PROFILE)
+LinkG := $(Link) -g -L$(LIBDEBUG) $(STRIP)
+LinkO := $(Link) -O3 -L$(LIBRELEASE)
+LinkP := $(Link) -O3 -L$(LIBPROFILE) $(PROFILE)
# Create one .o file from a bunch of .o files...
Relink = ld -r
USED_LIB_PATHS_G := $(addprefix $(LIBDEBUG)/, $(STATICUSEDLIBS))
USED_LIB_PATHS_O := $(addprefix $(LIBRELEASE)/, $(STATICUSEDLIBS))
USED_LIB_PATHS_P := $(addprefix $(LIBPROFILE)/, $(STATICUSEDLIBS))
+LINK_OPTS := $(TOOLLINKOPTS) $(PLATFORMLINKOPTS)
all:: $(TOOLEXENAMES)
clean::
$(TOOLEXENAME_G): $(ObjectsG) $(USED_LIB_PATHS_G) $(BUILD_ROOT_TOP)/tools/Debug/.dir
@echo ======= Linking $(TOOLNAME) debug executable $(WARN_MSG) =======
- $(VERB) $(LinkG) -o $@ $(ObjectsG) $(USED_LIBS_OPTIONS_G) $(TOOLLINKOPTS)
+ $(VERB) $(LinkG) -o $@ $(ObjectsG) $(USED_LIBS_OPTIONS_G) $(LINK_OPTS)
$(TOOLEXENAME_O): $(ObjectsO) $(USED_LIB_PATHS_O) $(BUILD_ROOT_TOP)/tools/Release/.dir
@echo ======= Linking $(TOOLNAME) release executable =======
- $(VERB) $(LinkO) -o $@ $(ObjectsG) $(USED_LIBS_OPTIONS_O) $(TOOLLINKOPTS)
+ $(VERB) $(LinkO) -o $@ $(ObjectsO) $(USED_LIBS_OPTIONS_O) $(LINK_OPTS)
$(TOOLEXENAME_P): $(ObjectsP) $(USED_LIB_PATHS_P) $(BUILD_ROOT_TOP)/tools/Profile/.dir
@echo ======= Linking $(TOOLNAME) profile executable =======
- $(VERB) $(LinkP) -o $@ $(ObjectsP) $(USED_LIBS_OPTIONS_P) $(TOOLLINKOPTS)
+ $(VERB) $(LinkP) -o $@ $(ObjectsP) $(USED_LIBS_OPTIONS_P) $(LINK_OPTS)
endif
$(VERB) $(CompileO) $< -o $@
$(BUILD_ROOT)/Release/%.o: %.c $(BUILD_ROOT)/Release/.dir
- $(VERB) $(CompileOC) $< -o $@
+ $(VERB) $(CompileCO) $< -o $@
$(BUILD_ROOT)/Profile/%.o: %.cpp $(BUILD_ROOT)/Profile/.dir
@echo "Compiling $<"
# 'make clean' nukes the tree
clean::
$(VERB) rm -rf $(BUILD_ROOT)/Debug $(BUILD_ROOT)/Release $(BUILD_ROOT)/Profile $(BUILD_ROOT)/Depend
- $(VERB) rm -f core *.o *.d *.so *~ *.flc
+ $(VERB) rm -f core core.[0-9][0-9]* *.o *.d *.so *~ *.flc
# If dependancies were generated for the file that included this file,
# include the dependancies now...
#
SourceDepend := $(addsuffix .d,$(addprefix $(BUILD_ROOT)/Depend/,$(basename $(filter-out Debug/%, $(Source)))))
ifneq ($(SourceDepend),)
-include $(SourceDepend)
+-include $(SourceDepend)
endif