.endif
DP_ARCH != uname
-# Command used to delete files
+
+# Makefile name
+MAKEFILE=BSDmakefile
+
+# Commands
CMD_RM=$(CMD_UNIXRM)
+CMD_CP=$(CMD_UNIXCP)
+CMD_MKDIR=$(CMD_UNIXMKDIR)
# default targets
TARGETS_DEBUG=sv-debug cl-debug sdl-debug
MAKE:=$(MAKE) -f BSDmakefile
-DO_LD=$(CC) -o $@ $> $(LDFLAGS)
+DO_LD=$(CC) -o ../../../$@ $> $(LDFLAGS)
##### Definitions shared by all makefiles #####
DP_MACHINE:=$(shell uname -m)
endif
+# Makefile name
+MAKEFILE=makefile
-# Command used to delete files
+# Commands
ifdef windir
CMD_RM=del
+ CMD_CP=copy /y
+ CMD_MKDIR=mkdir
else
CMD_RM=$(CMD_UNIXRM)
+ CMD_CP=$(CMD_UNIXCP)
+ CMD_MKDIR=$(CMD_UNIXMKDIR)
endif
# 64bits AMD CPUs use another lib directory
##### GNU Make specific definitions #####
-DO_LD=$(CC) -o $@ $^ $(LDFLAGS)
+DO_LD=$(CC) -o ../../../$@ $^ $(LDFLAGS)
##### Definitions shared by all makefiles #####
# Compilation
-CFLAGS_COMMON=$(CFLAGS_MAKEDEP) $(CFLAGS_PRELOAD) $(CFLAGS_FS) $(CFLAGS_WARNINGS) $(CFLAGS_LIBZ) $(CFLAGS_LIBJPEG) $(CFLAGS_D3D) -D_FILE_OFFSET_BITS=64 -D__KERNEL_STRICT_NAMES
+CFLAGS_COMMON=$(CFLAGS_MAKEDEP) $(CFLAGS_PRELOAD) $(CFLAGS_FS) $(CFLAGS_WARNINGS) $(CFLAGS_LIBZ) $(CFLAGS_LIBJPEG) $(CFLAGS_D3D) -D_FILE_OFFSET_BITS=64 -D__KERNEL_STRICT_NAMES -I../../../
CFLAGS_DEBUG=-ggdb
CFLAGS_PROFILE=-g -pg -ggdb -fprofile-arcs
CFLAGS_RELEASE=
EXE_UNIXSDLNEXUIZ=nexuiz-sdl
CMD_UNIXRM=rm -rf
+CMD_UNIXCP=cp -f
+CMD_UNIXMKDIR=mkdir -p
##### Linux specific variables #####
EXE_WINSVNEXUIZ=nexuiz-dedicated.exe
EXE_WINSDLNEXUIZ=nexuiz-sdl.exe
+VPATH := ../../../
##### Commands #####
$(CHECKLEVEL1)
@echo
@echo "========== $(EXE) (debug) =========="
- $(MAKE) $(EXE) \
+ $(MAKE) prepare BUILD_DIR=obj/debug/$(EXE)
+ $(MAKE) -C obj/debug/$(EXE) -f ../../../$(MAKEFILE) $(EXE) \
DP_MAKE_TARGET=$(DP_MAKE_TARGET) DP_SOUND_API=$(DP_SOUND_API) \
CFLAGS="$(CFLAGS_COMMON) $(CFLAGS_EXTRA) $(CFLAGS_DEBUG) $(OPTIM_DEBUG)"\
LDFLAGS="$(LDFLAGS_DEBUG) $(LDFLAGS_COMMON)" LEVEL=2
$(CHECKLEVEL1)
@echo
@echo "========== $(EXE) (profile) =========="
- $(MAKE) $(EXE) \
+ $(MAKE) prepare BUILD_DIR=obj/profile/$(EXE)
+ $(MAKE) -C obj/profile/$(EXE) -f ../../../$(MAKEFILE) $(EXE) \
DP_MAKE_TARGET=$(DP_MAKE_TARGET) DP_SOUND_API=$(DP_SOUND_API) \
CFLAGS="$(CFLAGS_COMMON) $(CFLAGS_EXTRA) $(CFLAGS_PROFILE) $(OPTIM_RELEASE)"\
LDFLAGS="$(LDFLAGS_PROFILE) $(LDFLAGS_COMMON)" LEVEL=2
$(CHECKLEVEL1)
@echo
@echo "========== $(EXE) (release) =========="
- $(MAKE) $(EXE) \
+ $(MAKE) prepare BUILD_DIR=obj/release/$(EXE)
+ $(MAKE) -C obj/release/$(EXE) -f ../../../$(MAKEFILE) $(EXE) \
DP_MAKE_TARGET=$(DP_MAKE_TARGET) DP_SOUND_API=$(DP_SOUND_API) \
CFLAGS="$(CFLAGS_COMMON) $(CFLAGS_EXTRA) $(CFLAGS_RELEASE) $(OPTIM_RELEASE)"\
LDFLAGS="$(LDFLAGS_RELEASE) $(LDFLAGS_COMMON)" LEVEL=2
$(CHECKLEVEL1)
@echo
@echo "========== $(EXE) (release) =========="
- $(MAKE) $(EXE) \
+ $(MAKE) prepare BUILD_DIR=obj/release-profile/$(EXE)
+ $(MAKE) -C obj/release-profile/$(EXE) -f ../../../$(MAKEFILE) $(EXE) \
DP_MAKE_TARGET=$(DP_MAKE_TARGET) DP_SOUND_API=$(DP_SOUND_API) \
CFLAGS="$(CFLAGS_COMMON) $(CFLAGS_EXTRA) $(CFLAGS_RELEASE_PROFILE) $(OPTIM_RELEASE)"\
LDFLAGS="$(LDFLAGS_RELEASE) $(LDFLAGS_COMMON)" LEVEL=2
$(STRIP) $(EXE)
+prepare :
+ $(CMD_MKDIR) $(BUILD_DIR)
+ $(CMD_CP) makefile.inc $(BUILD_DIR)/
snd_modplug.o: snd_modplug.c
$(CHECKLEVEL2)
-$(CMD_RM) $(EXE_SDLNEXUIZ)
-$(CMD_RM) *.o
-$(CMD_RM) *.d
+ -$(CMD_RM) obj/
clean-profile: clean
-$(CMD_RM) *.gcda