gzdoom-gles/Makefile.linux
Randy Heit 7a601515df - ClassifyLine now chooses either SSE2 or regular x87 math depending on whether
or not SSE2 is available at runtime. Since most of the time is spent in
  ClassifyLine, using SSE2 in just this one function helps the most.
- Nodebuilding is a little faster if we inline PointOnSide.
- Changed FEventTree into a regular binary tree, since there just aren't enough
  nodes inserted into it to make a red-black tree worthwhile.
- Added more checks at the start of ClassifyLine so that it has a better chance
  of avoiding the more complicated checking, and it seems to have paid off with
  a reasonably modest performance boost.
- Added a "vertex map" for ZDBSP's vertex selection. (Think BLOCKMAP for
  vertices instead of lines.) On large maps, this can result in a very
  significant speed up. (In one particular map, ZDBSP had previously
  spent 40% of its time just scanning through all the vertices in the
  map. Now the time it spends finding vertices is immeasurable.) On small maps,
  this won't make much of a difference, because the number of vertices to search
  was so small to begin with.


SVN r173 (trunk)
2006-06-06 21:39:08 +00:00

165 lines
4.9 KiB
Text

# created on 4/12/2006 by James Bentler
# RH says: Might I suggest using -MMD instead of -MM? You can create the
# .o files and the .d files in the same step and avoid rerunning make.
# I'd do it myself, but I don't want to break anything without testing
# it first.
CXX ?= g++
CC ?= gcc
NASM ?= nasm
ifdef DEBUG
CFLAGS ?= -pipe -Wall -Wno-unused
else
CFLAGS ?= -pipe -Wall -Wno-unused -O2 -fomit-frame-pointer -fno-rtti
endif
ifdef GC
CFLAGS += -ffunction-sections
LDFLAGS += -Wl,--gc-sections
endif
CFLAGS += -DHAVE_FILELENGTH -D__forceinline=inline -Izlib -IFLAC `sdl-config --cflags`
CFLAGS += -Dstricmp=strcasecmp -Dstrnicmp=strncasecmp -DNEED_STRUPR
LDFLAGS += -lFLAC++ -lFLAC -lz -lfmod `sdl-config --libs`
NASMFLAGS += -f elf -DM_TARGET_LINUX
SRCDIRS = src/ $(addprefix src/,g_doom/ g_heretic/ g_hexen/ g_raven/ g_shared/ g_strife/ oplsynth/ sound/ sdl/)
INCLUDES = $(addprefix -I,$(SRCDIRS))
CFLAGS += $(INCLUDES)
RELEASEOBJ ?= releaseobj
DEBUGOBJ ?= debugobj
CPPSRCS = $(wildcard $(addsuffix *.cpp,$(SRCDIRS)))
CSRCS = $(wildcard $(addsuffix *.c,$(SRCDIRS)))
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 += -s -Wl,-Map=$(ZDOOM).map
ZDOOMBIN = $(ZDOOM)
endif
CXXFLAGS += $(CFLAGS)
COBJS = $(addprefix $(OBJDIR)/,$(CPPOBJFILES) $(COBJFILES))
DEPS = $(patsubst %.o,%.d,$(COBJS))
OBJS = $(addprefix $(OBJDIR)/,$(AOBJFILES)) $(COBJS)
# controls whether to start another instance of make at deps
RESTART?=1
# rule pattern for dependencies
define DEPBUILD_PATTERN
_dep_: _src_
$(CXX) _src_ -MM $(CXXFLAGS) -MT "$$(patsubst %.d,%.o,_dep_) _dep_" -MF _dep_
endef
# rule pattern for assembly files
define ASMBUILD_PATTERN
_obj_: _src_
$(NASM) -o _obj_ $(NASMFLAGS) _src_
endef
define CBUILD_PATTERN
_obj_: _src_
$(CC) -c $(CFLAGS) -o _obj_ -c _src_
endef
all: $(ZDOOMBIN) toolsandpk3 zdoom.pk3
$(ZDOOMBIN): $(OBJDIR) $(if $(RESTART),deps) $(OBJS)
ifndef RESTART
$(CXX) $(LDFLAGS) $(OBJDIR)/autostart.o \
$(filter-out %/autostart.o %/autozend.o,$(OBJS)) \
$(OBJDIR)/autozend.o -o $(ZDOOMBIN)
endif
# include any of the dep files that already exist if we aren't making clean
$(if !$(findstring clean,$(MAKECMDGOALS)),$(foreach dep,$(DEPS),$(if $(wildcard $(dep)),$(eval include $(dep)))))
# textually substitute in the _dep_ and the _src_ it depends on to create rules
# for creating dependency files without any existing dependency files
$(foreach src,$(CPPSRCS) $(CSRCS), $(eval $(subst _src_,$(src),$(subst \
_dep_,$(OBJDIR)/$(patsubst %.c,%.d,$(patsubst %.cpp,%.d,$(notdir $$$(src)))),\
$(DEPBUILD_PATTERN)))))
# textually substitute in the _obj_ and the _src_ it depends on to create rules
$(foreach src,$(ASRCS), $(eval $(subst _src_,$(src),$(subst \
_obj_,$(OBJDIR)/$(patsubst %.nas,%.o,$(notdir $$$(src))),$(ASMBUILD_PATTERN)))))
# textually substitute in the _obj_ and the _src_ it depends on to create rules
$(foreach src,$(CSRCS), $(eval $(subst _src_,$(src),$(subst \
_obj_,$(OBJDIR)/$(patsubst %.c,%.o,$(notdir $$$(src))),$(CBUILD_PATTERN)))))
$(OBJDIR)/%.o:
$(CXX) -c $(CXXFLAGS) -o $@ -c $<
# Hi, you Linux people. This works with Makefile.mingw, so i assume it works here too.
# This file needs special handling so that it actually gets compiled with SSE2 support.
$(OBJDIR)/nodebuild_classify_sse2.o: nodebuild_classify_sse2.cpp
$(CXX) $(CXXFLAGS) -msse2 -mfpmath=sse -c -o $@ $<
# start a new instance of make after dependency files have been made
deps: $(DEPS)
ifdef RESTART
@make -f $(firstword $(MAKEFILE_LIST)) RESTART=
endif
$(OBJDIR):
mkdir $(OBJDIR)
toolsandpk3: tools/makewad/makewad tools/dehsupp/dehsupp tools/xlatcc/xlatcc
make -C wadsrc/
zdoom.pk3: toolsandpk3
ln -sf wadsrc/zdoom.pk3 ./
tools/makewad/makewad:
make -C tools/makewad/
tools/dehsupp/dehsupp:
make -C tools/dehsupp/
tools/xlatcc/xlatcc:
make -C tools/xlatcc/
.PHONY : clean cleandeps cleanobjs distclean deps toolsandpk3
clean: cleanobjs
rm -f $(ZDOOMDEBUG) $(ZDOOM) $(ZDOOM).map
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)
cleandeps:
rm -f $(RELEASEOBJ)/*.d $(DEBUGOBJ)/*.d
cleanobjs:
rm -f $(RELEASEOBJ)/*.o $(DEBUGOBJ)/*.o