* Generate QVM dependicies in a (much) better way

This commit is contained in:
Tim Angus 2007-07-16 23:30:53 +00:00
parent 155802bc0c
commit 3944b02025

103
Makefile
View file

@ -733,8 +733,7 @@ ifneq ($(BUILD_GAME_QVM),0)
$(B)/baseq3/vm/ui.qvm \ $(B)/baseq3/vm/ui.qvm \
$(B)/missionpack/vm/qagame.qvm \ $(B)/missionpack/vm/qagame.qvm \
$(B)/missionpack/vm/cgame.qvm \ $(B)/missionpack/vm/cgame.qvm \
$(B)/missionpack/vm/ui.qvm \ $(B)/missionpack/vm/ui.qvm
qvmdeps
endif endif
endif endif
@ -758,20 +757,52 @@ ifeq ($(USE_SVN),1)
BASE_CFLAGS += -DSVN_VERSION=\\\"$(SVN_VERSION)\\\" BASE_CFLAGS += -DSVN_VERSION=\\\"$(SVN_VERSION)\\\"
endif endif
DO_CC = @echo "CC $<"; \ define DO_CC
$(CC) $(NOTSHLIBCFLAGS) $(CFLAGS) -o $@ -c $< @echo "CC $<"
DO_SMP_CC = @echo "SMP_CC $<"; \ @$(CC) $(NOTSHLIBCFLAGS) $(CFLAGS) -o $@ -c $<
$(CC) $(NOTSHLIBCFLAGS) $(CFLAGS) -DSMP -o $@ -c $< endef
DO_BOT_CC = @echo "BOT_CC $<"; \
$(CC) $(NOTSHLIBCFLAGS) $(CFLAGS) $(BOTCFLAGS) -DBOTLIB -o $@ -c $< define DO_SMP_CC
DO_SHLIB_CC = @echo "SHLIB_CC $<"; \ @echo "SMP_CC $<"
$(CC) $(CFLAGS) $(SHLIBCFLAGS) -o $@ -c $< @$(CC) $(NOTSHLIBCFLAGS) $(CFLAGS) -DSMP -o $@ -c $<
DO_AS = @echo "AS $<"; \ endef
$(CC) $(CFLAGS) -DELF -x assembler-with-cpp -o $@ -c $<
DO_DED_CC = @echo "DED_CC $<"; \ define DO_BOT_CC
$(CC) $(NOTSHLIBCFLAGS) -DDEDICATED $(CFLAGS) -o $@ -c $< @echo "BOT_CC $<"
DO_WINDRES = @echo "WINDRES $<"; \ @$(CC) $(NOTSHLIBCFLAGS) $(CFLAGS) $(BOTCFLAGS) -DBOTLIB -o $@ -c $<
$(WINDRES) -i $< -o $@ endef
ifeq ($(GENERATE_DEPENDENCIES),1)
DO_QVM_DEP=cat $(@:%.o=%.d) | sed -e 's/\.o/\.asm/g' >> $(@:%.o=%.d)
endif
define DO_SHLIB_CC
@echo "SHLIB_CC $<"
@$(CC) $(CFLAGS) $(SHLIBCFLAGS) -o $@ -c $<
@$(DO_QVM_DEP)
endef
define DO_SHLIB_CC_MISSIONPACK
@echo "SHLIB_CC_MISSIONPACK $<"
@$(CC) -DMISSIONPACK $(CFLAGS) $(SHLIBCFLAGS) -o $@ -c $<
@$(DO_QVM_DEP)
endef
define DO_AS
@echo "AS $<"
@$(CC) $(CFLAGS) -DELF -x assembler-with-cpp -o $@ -c $<
endef
define DO_DED_CC
@echo "DED_CC $<"
@$(CC) $(NOTSHLIBCFLAGS) -DDEDICATED $(CFLAGS) -o $@ -c $<
endef
define DO_WINDRES
@echo "WINDRES $<"
@$(WINDRES) -i $< -o $@
endef
############################################################################# #############################################################################
# MAIN TARGETS # MAIN TARGETS
@ -842,8 +873,16 @@ tools:
$(MAKE) -C $(TOOLSDIR)/asm install $(MAKE) -C $(TOOLSDIR)/asm install
endif endif
DO_Q3LCC = @echo "Q3LCC $<"; \ define DO_Q3LCC
$(Q3LCC) -o $@ $< @echo "Q3LCC $<"
@$(Q3LCC) -o $@ $<
endef
define DO_Q3LCC_MISSIONPACK
@echo "Q3LCC_MISSIONPACK $<"
@$(Q3LCC) -DMISSIONPACK -o $@ $<
endef
############################################################################# #############################################################################
# CLIENT/SERVER # CLIENT/SERVER
@ -1551,10 +1590,10 @@ $(B)/baseq3/cgame/%.asm: $(CGDIR)/%.c
$(DO_Q3LCC) $(DO_Q3LCC)
$(B)/missionpack/cgame/%.o: $(CGDIR)/%.c $(B)/missionpack/cgame/%.o: $(CGDIR)/%.c
$(DO_SHLIB_CC) -DMISSIONPACK $(DO_SHLIB_CC_MISSIONPACK)
$(B)/missionpack/cgame/%.asm: $(CGDIR)/%.c $(B)/missionpack/cgame/%.asm: $(CGDIR)/%.c
$(DO_Q3LCC) -DMISSIONPACK $(DO_Q3LCC_MISSIONPACK)
$(B)/baseq3/game/%.o: $(GDIR)/%.c $(B)/baseq3/game/%.o: $(GDIR)/%.c
@ -1564,10 +1603,10 @@ $(B)/baseq3/game/%.asm: $(GDIR)/%.c
$(DO_Q3LCC) $(DO_Q3LCC)
$(B)/missionpack/game/%.o: $(GDIR)/%.c $(B)/missionpack/game/%.o: $(GDIR)/%.c
$(DO_SHLIB_CC) -DMISSIONPACK $(DO_SHLIB_CC_MISSIONPACK)
$(B)/missionpack/game/%.asm: $(GDIR)/%.c $(B)/missionpack/game/%.asm: $(GDIR)/%.c
$(DO_Q3LCC) -DMISSIONPACK $(DO_Q3LCC_MISSIONPACK)
$(B)/baseq3/ui/%.o: $(Q3UIDIR)/%.c $(B)/baseq3/ui/%.o: $(Q3UIDIR)/%.c
@ -1577,10 +1616,10 @@ $(B)/baseq3/ui/%.asm: $(Q3UIDIR)/%.c
$(DO_Q3LCC) $(DO_Q3LCC)
$(B)/missionpack/ui/%.o: $(UIDIR)/%.c $(B)/missionpack/ui/%.o: $(UIDIR)/%.c
$(DO_SHLIB_CC) -DMISSIONPACK $(DO_SHLIB_CC_MISSIONPACK)
$(B)/missionpack/ui/%.asm: $(UIDIR)/%.c $(B)/missionpack/ui/%.asm: $(UIDIR)/%.c
$(DO_Q3LCC) -DMISSIONPACK $(DO_Q3LCC_MISSIONPACK)
$(B)/baseq3/qcommon/%.o: $(CMDIR)/%.c $(B)/baseq3/qcommon/%.o: $(CMDIR)/%.c
@ -1590,10 +1629,10 @@ $(B)/baseq3/qcommon/%.asm: $(CMDIR)/%.c
$(DO_Q3LCC) $(DO_Q3LCC)
$(B)/missionpack/qcommon/%.o: $(CMDIR)/%.c $(B)/missionpack/qcommon/%.o: $(CMDIR)/%.c
$(DO_SHLIB_CC) -DMISSIONPACK $(DO_SHLIB_CC_MISSIONPACK)
$(B)/missionpack/qcommon/%.asm: $(CMDIR)/%.c $(B)/missionpack/qcommon/%.asm: $(CMDIR)/%.c
$(DO_Q3LCC) -DMISSIONPACK $(DO_Q3LCC_MISSIONPACK)
############################################################################# #############################################################################
@ -1675,18 +1714,10 @@ dist:
D_FILES=$(shell find . -name '*.d') D_FILES=$(shell find . -name '*.d')
$(B)/baseq3/vm/vm.d: $(Q3GOBJ) $(Q3CGOBJ) $(Q3UIOBJ)
@cat $(^:%.o=%.d) | sed -e 's/\.o/\.asm/g' > $@
$(B)/missionpack/vm/vm.d: $(MPGOBJ) $(MPCGOBJ) $(MPUIOBJ)
@cat $(^:%.o=%.d) | sed -e 's/\.o/\.asm/g' > $@
qvmdeps: $(B)/baseq3/vm/vm.d $(B)/missionpack/vm/vm.d
ifneq ($(strip $(D_FILES)),) ifneq ($(strip $(D_FILES)),)
include $(D_FILES) include $(D_FILES)
endif endif
.PHONY: all clean clean2 clean-debug clean-release copyfiles \ .PHONY: all clean clean2 clean-debug clean-release copyfiles \
debug default dist distclean installer makedirs qvmdeps \ debug default dist distclean installer makedirs release \
release targets tools toolsclean targets tools toolsclean