mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-27 14:32:08 +00:00
e203ccda20
Build with make VALGRIND=1 to turn them on. SVN r1025 (trunk)
188 lines
5.1 KiB
Text
188 lines
5.1 KiB
Text
# created on 4/12/2006 by James Bentler
|
|
|
|
FMOD_PREFIX = /usr/local
|
|
CXX ?= g++
|
|
CC ?= gcc
|
|
NASM ?= nasm
|
|
CCDV = @./ccdv
|
|
|
|
# Can be libdumbd.a, if you really need to debug DUMB
|
|
DUMBLIB ?= libdumbd.a
|
|
|
|
ifndef X64
|
|
ifeq (x86_64,$(shell uname -m))
|
|
X64=64
|
|
else
|
|
X64=
|
|
endif
|
|
endif
|
|
|
|
ifdef DEBUG
|
|
CFLAGS ?= -pipe -Wall -Wno-unused -fno-strict-aliasing
|
|
else
|
|
CFLAGS ?= -pipe -Wall -Wno-unused -fno-strict-aliasing -O2 -fomit-frame-pointer
|
|
CXXFLAGS ?= -fno-rtti
|
|
endif
|
|
#ifdef GC
|
|
# CFLAGS += -ffunction-sections
|
|
# LDFLAGS += -Wl,--gc-sections
|
|
#endif
|
|
CFLAGS += -MMD -DHAVE_FILELENGTH -D__forceinline=inline `sdl-config --cflags` `pkg-config gtk+-2.0 --cflags`
|
|
CFLAGS += -Dstricmp=strcasecmp -Dstrnicmp=strncasecmp -DNEED_STRUPR
|
|
LDFLAGS += -lz -ljpeg `sdl-config --libs` `pkg-config gtk+-2.0 --libs` $(FMOD_PREFIX)/lib/libfmodex${X64}.so
|
|
NASMFLAGS += -f elf -DM_TARGET_LINUX
|
|
|
|
ifdef VALGRIND
|
|
NOSTRIP = 1
|
|
NASMFLAGS += -DVALGRIND_AWARE
|
|
endif
|
|
|
|
SRCDIRS = src/ $(addprefix src/,g_doom/ g_heretic/ g_hexen/ g_raven/ g_shared/ g_strife/ oplsynth/ sound/ sdl/ textures/ thingdef/ xlat/ timidity/)
|
|
VPATH = $(SRCDIRS)
|
|
INCLUDES = $(addprefix -I,$(SRCDIRS))
|
|
INCLUDES += -Isnes_spc/snes_spc/ -I$(FMOD_PREFIX)/include/fmodex/
|
|
CFLAGS += $(INCLUDES)
|
|
|
|
RELEASEOBJ ?= releaseobj
|
|
DEBUGOBJ ?= debugobj
|
|
|
|
CPPSRCS = $(wildcard $(addsuffix *.cpp,$(SRCDIRS)))
|
|
CSRCS = $(filter-out src/xlat/xlat_parser.c, $(wildcard $(addsuffix *.c,$(SRCDIRS))))
|
|
ifdef X64
|
|
NOASM=1
|
|
endif
|
|
ifdef NOASM
|
|
CFLAGS += -DNOASM
|
|
else
|
|
ASRCS = $(wildcard src/*.nas)
|
|
CFLAGS += -DUSEASM=1
|
|
endif
|
|
SRCS = $(CSRCS) $(CPPSRCS) $(ASRCS)
|
|
CPPOBJFILES = $(notdir $(patsubst %.cpp,%.o,$(CPPSRCS)))
|
|
COBJFILES = $(notdir $(patsubst %.c,%.o,$(CSRCS)))
|
|
AOBJFILES = $(notdir $(patsubst %.nas,%.o,$(ASRCS)))
|
|
|
|
ZDOOM = zdoom
|
|
ZDOOMDEBUG = zdoomd
|
|
|
|
ifdef DEBUG
|
|
OBJDIR = $(DEBUGOBJ)
|
|
CFLAGS += -D_DEBUG -g3
|
|
NASMFLAGS += -g
|
|
ZDOOMBIN = $(ZDOOMDEBUG)
|
|
else
|
|
OBJDIR = $(RELEASEOBJ)
|
|
CFLAGS += -DNDEBUG
|
|
LDFLAGS += -Wl,-Map=$(ZDOOM).map
|
|
ifndef NOSTRIP
|
|
LDFLAGS += -s
|
|
else
|
|
CFLAGS += -g
|
|
endif
|
|
ZDOOMBIN = $(ZDOOM)
|
|
endif
|
|
CXXFLAGS += $(CFLAGS)
|
|
|
|
COBJS = $(addprefix $(OBJDIR)/,$(CPPOBJFILES) $(COBJFILES))
|
|
DEPS = $(patsubst %.o,%.d,$(COBJS))
|
|
OBJS = $(addprefix $(OBJDIR)/,$(AOBJFILES)) $(COBJS)
|
|
|
|
all: $(ZDOOMBIN) toolsandpk3 zdoom.pk3
|
|
|
|
$(ZDOOMBIN): ccdv updaterev src/xlat/xlat_parser.h src/xlat/xlat_parser.c $(OBJDIR) $(OBJS) snes_spc/libsnes_spc.a dumb/lib/$(DUMBLIB)
|
|
$(CCDV) $(CXX) $(LDFLAGS) $(OBJDIR)/autostart.o \
|
|
$(filter-out %/autostart.o %/autozend.o,$(OBJS)) \
|
|
snes_spc/libsnes_spc.a dumb/lib/$(DUMBLIB) $(OBJDIR)/autozend.o -o $(ZDOOMBIN)
|
|
|
|
$(OBJDIR)/%.o: %.cpp
|
|
$(CCDV) $(CXX) $(CXXFLAGS) -o $@ -c $<
|
|
|
|
$(OBJDIR)/%.o: %.c
|
|
$(CCDV) $(CC) $(CFLAGS) -o $@ -c $<
|
|
|
|
$(OBJDIR)/%.o: %.nas
|
|
$(CCDV) $(NASM) -o $@ $(NASMFLAGS) $<
|
|
|
|
# This file needs special handling so that it actually gets compiled with SSE2 support.
|
|
$(OBJDIR)/nodebuild_classify_sse2.o: nodebuild_classify_sse2.cpp
|
|
$(CCDV) $(CXX) $(CXXFLAGS) -msse2 -mfpmath=sse -c -o $@ $<
|
|
|
|
# This file needs special handling because GCC misoptimizes it otherwise.
|
|
$(OBJDIR)/fmopl.o: src/oplsynth/fmopl.cpp
|
|
$(CCDV) $(CXX) $(CXXFLAGS) -fno-tree-dominator-opts -fno-tree-fre -c -o $@ $<
|
|
|
|
src/xlat/xlat_parser.h src/xlat/xlat_parser.c: tools/lemon/lemon src/xlat/xlat_parser.y
|
|
$(CCDV) tools/lemon/lemon -s src/xlat/xlat_parser.y
|
|
|
|
$(OBJDIR):
|
|
mkdir $(OBJDIR)
|
|
|
|
toolsandpk3: ccdv tools/makewad/makewad tools/dehsupp/dehsupp tools/lemon/lemon
|
|
$(MAKE) -C wadsrc/
|
|
|
|
zdoom.pk3: toolsandpk3
|
|
ln -sf wadsrc/zdoom.pk3 ./
|
|
|
|
snes_spc/libsnes_spc.a: ccdv
|
|
$(MAKE) -C snes_spc/
|
|
|
|
dumb/lib/libdumb.a: ccdv
|
|
$(MAKE) -C dumb/
|
|
|
|
dumb/lib/libdumbd.a: ccdv
|
|
$(MAKE) CONFIG=Debug -C dumb/
|
|
|
|
tools/makewad/makewad: ccdv
|
|
$(MAKE) -C tools/makewad/
|
|
|
|
tools/dehsupp/dehsupp: ccdv
|
|
$(MAKE) -C tools/dehsupp/
|
|
|
|
tools/lemon/lemon: ccdv
|
|
$(MAKE) -C tools/lemon/
|
|
|
|
updaterev: tools/updaterevision/updaterevision
|
|
@tools/updaterevision/updaterevision . src/svnrevision.h
|
|
|
|
tools/updaterevision/updaterevision: ccdv
|
|
$(MAKE) -C tools/updaterevision
|
|
|
|
.PHONY : clean cleandeps cleanobjs distclean toolsandpk3 cleantools updaterev
|
|
|
|
clean: cleanobjs
|
|
rm -f $(ZDOOMDEBUG) $(ZDOOM) $(ZDOOM).map
|
|
rm -f ccdv
|
|
@$(MAKE) -C snes_spc clean
|
|
|
|
cleantools:
|
|
@$(MAKE) -C wadsrc clean
|
|
@$(MAKE) -C tools/makewad clean
|
|
@$(MAKE) -C tools/dehsupp clean
|
|
@$(MAKE) -C tools/updaterevision clean
|
|
@$(MAKE) -C tools/lemon clean
|
|
|
|
cleandebug:
|
|
rm -f $(ZDOOMDEBUG) $(DEBUGOBJ)/*.o $(DEBUGOBJ)/*.d
|
|
-rmdir $(DEBUGOBJ)
|
|
|
|
cleanrelease:
|
|
rm -f $(ZDOOM) $(ZDOOM).map $(RELEASEOBJ)/*.o $(RELEASEOBJ)/*.o
|
|
-rmdir $(RELEASEOBJ)
|
|
|
|
# I could use a recursive delete instead, but that could be dangerous...
|
|
distclean: clean cleandeps
|
|
-rmdir $(RELEASEOBJ) $(DEBUGOBJ)
|
|
rm -f zdoom.pk3
|
|
|
|
cleandeps:
|
|
rm -f $(RELEASEOBJ)/*.d $(DEBUGOBJ)/*.d
|
|
|
|
cleanobjs:
|
|
rm -f $(RELEASEOBJ)/*.o $(DEBUGOBJ)/*.o
|
|
|
|
ccdv: ccdv-posix.c
|
|
@gcc -Os -s ccdv-posix.c -o ccdv
|
|
|
|
ifeq (,$(findstring $(MAKECMDGOALS),clean cleandeps cleanobjs distclean toolsandpk3 cleantools updaterev))
|
|
-include $(DEPS)
|
|
endif
|