2006-04-13 02:01:40 +00:00
|
|
|
# created on 4/12/2006 by James Bentler
|
2006-06-06 21:39:08 +00:00
|
|
|
|
2006-04-13 02:01:40 +00:00
|
|
|
CXX ?= g++
|
2006-04-13 22:35:56 +00:00
|
|
|
CC ?= gcc
|
2006-05-09 21:30:31 +00:00
|
|
|
NASM ?= nasm
|
2006-06-08 02:43:35 +00:00
|
|
|
CCDV = @./ccdv
|
2006-06-05 07:56:30 +00:00
|
|
|
ifdef DEBUG
|
2006-06-08 02:43:35 +00:00
|
|
|
CFLAGS ?= -pipe -Wall -Wno-unused -fno-strict-aliasing
|
2006-04-21 16:32:49 +00:00
|
|
|
else
|
2006-06-08 02:43:35 +00:00
|
|
|
CFLAGS ?= -pipe -Wall -Wno-unused -fno-strict-aliasing -O2 -fomit-frame-pointer
|
|
|
|
CXXFLAGS ?= -fno-rtti
|
2006-06-05 07:56:30 +00:00
|
|
|
endif
|
|
|
|
ifdef GC
|
|
|
|
CFLAGS += -ffunction-sections
|
|
|
|
LDFLAGS += -Wl,--gc-sections
|
2006-04-21 16:32:49 +00:00
|
|
|
endif
|
2007-12-06 17:38:05 +00:00
|
|
|
CFLAGS += -MMD -DHAVE_FILELENGTH -D__forceinline=inline `sdl-config --cflags` `pkg-config gtk+-2.0 --cflags`
|
2006-04-17 13:53:34 +00:00
|
|
|
CFLAGS += -Dstricmp=strcasecmp -Dstrnicmp=strncasecmp -DNEED_STRUPR
|
2007-01-16 01:53:43 +00:00
|
|
|
LDFLAGS += -lFLAC++ -lFLAC -lz -ljpeg -lfmod `sdl-config --libs` `pkg-config gtk+-2.0 --libs`
|
2006-04-13 02:01:40 +00:00
|
|
|
NASMFLAGS += -f elf -DM_TARGET_LINUX
|
|
|
|
|
2007-07-12 15:15:57 +00:00
|
|
|
SRCDIRS = src/ $(addprefix src/,g_doom/ g_heretic/ g_hexen/ g_raven/ g_shared/ g_strife/ oplsynth/ sound/ sdl/ textures/ thingdef/)
|
2006-06-08 02:43:35 +00:00
|
|
|
VPATH = $(SRCDIRS)
|
2006-04-13 02:01:40 +00:00
|
|
|
INCLUDES = $(addprefix -I,$(SRCDIRS))
|
2006-04-13 22:35:56 +00:00
|
|
|
CFLAGS += $(INCLUDES)
|
2006-04-13 02:01:40 +00:00
|
|
|
|
|
|
|
RELEASEOBJ ?= releaseobj
|
|
|
|
DEBUGOBJ ?= debugobj
|
|
|
|
|
2006-04-13 22:35:56 +00:00
|
|
|
CPPSRCS = $(wildcard $(addsuffix *.cpp,$(SRCDIRS)))
|
|
|
|
CSRCS = $(wildcard $(addsuffix *.c,$(SRCDIRS)))
|
2006-06-05 07:56:30 +00:00
|
|
|
ifdef NOASM
|
|
|
|
CFLAGS += -DNOASM
|
|
|
|
else
|
2006-04-20 14:21:27 +00:00
|
|
|
ASRCS = $(wildcard src/*.nas)
|
|
|
|
CFLAGS += -DUSEASM=1
|
2006-04-13 22:35:56 +00:00
|
|
|
endif
|
|
|
|
SRCS = $(CSRCS) $(CPPSRCS) $(ASRCS)
|
|
|
|
CPPOBJFILES = $(notdir $(patsubst %.cpp,%.o,$(CPPSRCS)))
|
|
|
|
COBJFILES = $(notdir $(patsubst %.c,%.o,$(CSRCS)))
|
2006-04-13 02:01:40 +00:00
|
|
|
AOBJFILES = $(notdir $(patsubst %.nas,%.o,$(ASRCS)))
|
|
|
|
|
|
|
|
ZDOOM = zdoom
|
|
|
|
ZDOOMDEBUG = zdoomd
|
|
|
|
|
2006-06-05 07:56:30 +00:00
|
|
|
ifdef DEBUG
|
2006-04-13 02:01:40 +00:00
|
|
|
OBJDIR = $(DEBUGOBJ)
|
2006-04-13 22:35:56 +00:00
|
|
|
CFLAGS += -D_DEBUG -g3
|
2006-05-09 21:30:31 +00:00
|
|
|
NASMFLAGS += -g
|
2006-04-13 02:01:40 +00:00
|
|
|
ZDOOMBIN = $(ZDOOMDEBUG)
|
2006-06-05 07:56:30 +00:00
|
|
|
else
|
|
|
|
OBJDIR = $(RELEASEOBJ)
|
|
|
|
CFLAGS += -DNDEBUG
|
2007-01-25 04:02:06 +00:00
|
|
|
LDFLAGS += -Wl,-Map=$(ZDOOM).map
|
|
|
|
ifndef NOSTRIP
|
|
|
|
LDFLAGS += -s
|
|
|
|
endif
|
2006-06-05 07:56:30 +00:00
|
|
|
ZDOOMBIN = $(ZDOOM)
|
2006-04-13 02:01:40 +00:00
|
|
|
endif
|
2006-04-13 22:35:56 +00:00
|
|
|
CXXFLAGS += $(CFLAGS)
|
2006-04-13 02:01:40 +00:00
|
|
|
|
2006-04-17 13:53:34 +00:00
|
|
|
COBJS = $(addprefix $(OBJDIR)/,$(CPPOBJFILES) $(COBJFILES))
|
|
|
|
DEPS = $(patsubst %.o,%.d,$(COBJS))
|
|
|
|
OBJS = $(addprefix $(OBJDIR)/,$(AOBJFILES)) $(COBJS)
|
|
|
|
|
2006-05-09 21:30:31 +00:00
|
|
|
all: $(ZDOOMBIN) toolsandpk3 zdoom.pk3
|
2006-04-13 02:01:40 +00:00
|
|
|
|
2006-06-20 20:30:39 +00:00
|
|
|
$(ZDOOMBIN): ccdv updaterev $(OBJDIR) $(OBJS)
|
2006-06-08 02:43:35 +00:00
|
|
|
$(CCDV) $(CXX) $(LDFLAGS) $(OBJDIR)/autostart.o \
|
2006-04-20 14:21:27 +00:00
|
|
|
$(filter-out %/autostart.o %/autozend.o,$(OBJS)) \
|
|
|
|
$(OBJDIR)/autozend.o -o $(ZDOOMBIN)
|
2006-04-13 22:35:56 +00:00
|
|
|
|
2006-06-08 02:43:35 +00:00
|
|
|
$(OBJDIR)/%.o: %.cpp
|
|
|
|
$(CCDV) $(CXX) $(CXXFLAGS) -o $@ -c $<
|
2006-04-13 02:01:40 +00:00
|
|
|
|
2006-06-08 02:43:35 +00:00
|
|
|
$(OBJDIR)/%.o: %.c
|
|
|
|
$(CCDV) $(CC) $(CFLAGS) -o $@ -c $<
|
2006-04-13 02:01:40 +00:00
|
|
|
|
2006-06-08 02:43:35 +00:00
|
|
|
$(OBJDIR)/%.o: %.nas
|
|
|
|
$(CCDV) $(NASM) -o $@ $(NASMFLAGS) $<
|
2006-04-13 02:01:40 +00:00
|
|
|
|
2006-06-06 21:39:08 +00:00
|
|
|
# This file needs special handling so that it actually gets compiled with SSE2 support.
|
2006-06-08 02:43:35 +00:00
|
|
|
$(OBJDIR)/nodebuild_classify_sse2.o: nodebuild_classify_sse2.cpp
|
|
|
|
$(CCDV) $(CXX) $(CXXFLAGS) -msse2 -mfpmath=sse -c -o $@ $<
|
2006-04-13 02:01:40 +00:00
|
|
|
|
|
|
|
$(OBJDIR):
|
2006-04-20 14:21:27 +00:00
|
|
|
mkdir $(OBJDIR)
|
2006-04-13 02:01:40 +00:00
|
|
|
|
2006-06-08 02:43:35 +00:00
|
|
|
toolsandpk3: ccdv tools/makewad/makewad tools/dehsupp/dehsupp tools/xlatcc/xlatcc
|
2006-06-20 20:30:39 +00:00
|
|
|
$(MAKE) -C wadsrc/
|
2006-05-09 21:30:31 +00:00
|
|
|
|
|
|
|
zdoom.pk3: toolsandpk3
|
|
|
|
ln -sf wadsrc/zdoom.pk3 ./
|
|
|
|
|
|
|
|
tools/makewad/makewad:
|
2006-06-20 20:30:39 +00:00
|
|
|
$(MAKE) -C tools/makewad/
|
2006-05-09 21:30:31 +00:00
|
|
|
|
|
|
|
tools/dehsupp/dehsupp:
|
2006-06-20 20:30:39 +00:00
|
|
|
$(MAKE) -C tools/dehsupp/
|
2006-05-09 21:30:31 +00:00
|
|
|
|
|
|
|
tools/xlatcc/xlatcc:
|
2006-06-20 20:30:39 +00:00
|
|
|
$(MAKE) -C tools/xlatcc/
|
2006-04-17 13:53:34 +00:00
|
|
|
|
2006-06-20 20:30:39 +00:00
|
|
|
|
|
|
|
updaterev: tools/updaterevision/updaterevision
|
|
|
|
@tools/updaterevision/updaterevision . src/svnrevision.h
|
|
|
|
|
|
|
|
tools/updaterevision/updaterevision:
|
|
|
|
$(MAKE) -C tools/updaterevision
|
|
|
|
|
|
|
|
.PHONY : clean cleandeps cleanobjs distclean toolsandpk3 cleantools updaterev
|
2006-04-13 02:01:40 +00:00
|
|
|
|
2006-04-17 13:53:34 +00:00
|
|
|
clean: cleanobjs
|
2006-04-20 14:21:27 +00:00
|
|
|
rm -f $(ZDOOMDEBUG) $(ZDOOM) $(ZDOOM).map
|
2006-06-08 02:43:35 +00:00
|
|
|
rm -f ccdv
|
|
|
|
|
|
|
|
cleantools:
|
|
|
|
@$(MAKE) -C tools/makewad clean
|
|
|
|
@$(MAKE) -C tools/dehsupp clean
|
|
|
|
@$(MAKE) -C tools/xlatcc clean
|
2006-04-13 02:01:40 +00:00
|
|
|
|
2006-04-21 16:32:49 +00:00
|
|
|
cleandebug:
|
|
|
|
rm -f $(ZDOOMDEBUG) $(DEBUGOBJ)/*.o $(DEBUGOBJ)/*.d
|
|
|
|
-rmdir $(DEBUGOBJ)
|
|
|
|
|
|
|
|
cleanrelease:
|
|
|
|
rm -f $(ZDOOM) $(ZDOOM).map $(RELEASEOBJ)/*.o $(RELEASEOBJ)/*.o
|
|
|
|
-rmdir $(RELEASEOBJ)
|
|
|
|
|
2006-04-17 13:53:34 +00:00
|
|
|
# I could use a recursive delete instead, but that could be dangerous...
|
|
|
|
distclean: clean cleandeps
|
2006-04-21 16:32:49 +00:00
|
|
|
-rmdir $(RELEASEOBJ) $(DEBUGOBJ)
|
2006-04-13 02:01:40 +00:00
|
|
|
|
|
|
|
cleandeps:
|
2006-04-20 14:21:27 +00:00
|
|
|
rm -f $(RELEASEOBJ)/*.d $(DEBUGOBJ)/*.d
|
2006-04-13 02:01:40 +00:00
|
|
|
|
|
|
|
cleanobjs:
|
2006-04-20 14:21:27 +00:00
|
|
|
rm -f $(RELEASEOBJ)/*.o $(DEBUGOBJ)/*.o
|
|
|
|
|
2006-06-08 02:43:35 +00:00
|
|
|
ccdv: ccdv-posix.c
|
|
|
|
@gcc -Os -s ccdv-posix.c -o ccdv
|
|
|
|
|
2006-06-20 20:30:39 +00:00
|
|
|
ifeq (,$(findstring $(MAKECMDGOALS),clean cleandeps cleanobjs distclean toolsandpk3 cleantools updaterev))
|
2006-06-08 02:43:35 +00:00
|
|
|
-include $(DEPS)
|
2007-01-25 04:02:06 +00:00
|
|
|
endif
|