include Makefile.conf
CFLAGS = -MMD -W -Wall -Wcast-align -Wcast-qual -Wno-unused-parameter -fPIC
-CPPFLAGS = -DPOSIX -DXWINDOWS -D_LINUX
+CPPFLAGS =
CXXFLAGS = $(CFLAGS) -Wno-non-virtual-dtor -Wreorder -fno-exceptions -fno-rtti
CFLAGS_OPT ?= -O3
CFLAGS += $(CFLAGS_OPT)
LDFLAGS += -s
else
- $(error Unsupported build type)
+$(error Unsupported build type)
endif
ifeq ($(OS),Linux)
+ CPPFLAGS += -DPOSIX -DXWINDOWS -D_LINUX
LDFLAGS_DLL = -fPIC -ldl
LIBS = -lpthread
EXE = x86
CPPFLAGS_GTKGLEXT = `pkg-config gtkglext-1.0 --cflags`
LIBS_GTKGLEXT = `pkg-config gtkglext-1.0 --libs-only-l --libs-only-L`
else ifeq ($(OS),Win32)
- $(error Unsupported build OS)
+$(error Unsupported build OS)
else ifeq ($(OS),Darwin)
- $(error Unsupported build OS)
+$(error Unsupported build OS)
else
- $(error Unsupported build OS)
+$(error Unsupported build OS)
endif
RADIANT_ABOUTMSG = Custom build
.PHONY: all
all: \
- makeversion \
install/heretic2/h2data.$(EXE) \
install/modules/archivepak.$(DLL) \
install/modules/archivewad.$(DLL) \
$(CXX) -shared -o $@ $^ $(LDFLAGS) $(LDFLAGS_DLL) $(LIBS) $(LIBS_EXTRA)
[ -z "$(LDD)" ] || [ -z "`$(LDD) -r $@ 2>&1 >/dev/null $(TEE_STDERR)`" ] || { $(RM) $@; exit 1; }
-%.o: %.cpp
+%.o: %.cpp makeversion
$(CXX) -c -o $@ $< $(CXXFLAGS) $(CPPFLAGS) $(CPPFLAGS_EXTRA)
-%.o: %.c
+%.o: %.c makeversion
$(CC) -c -o $@ $< $(CFLAGS) $(CPPFLAGS) $(CPPFLAGS_EXTRA)
install/q3map2.$(EXE): LIBS_EXTRA := $(LIBS_XML) $(LIBS_GLIB) $(LIBS_PNG)
ver=`cat include/version.default`; \
major=`echo $$ver | cut -d . -f 2`; \
minor=`echo $$ver | cut -d . -f 3 | cut -d - -f 1`; \
- echo "// generated header, see Makefile" > include/version.h; \
- echo "#define RADIANT_VERSION \"$$ver\"" >> include/version.h; \
- echo "#define RADIANT_MAJOR_VERSION \"$$major\"" >> include/version.h; \
- echo "#define RADIANT_MINOR_VERSION \"$$minor\"" >> include/version.h; \
- echo "$$major" > include/RADIANT_MAJOR; \
- echo "$$minor" > include/RADIANT_MINOR; \
- echo "$$ver" > include/version; \
- echo "// generated header, see Makefile" > include/aboutmsg.h; \
- echo "#define RADIANT_ABOUTMSG \"$(RADIANT_ABOUTMSG)\"" >> include/aboutmsg.h; \
+ echo "// generated header, see Makefile" > include/version.h.new; \
+ echo "#define RADIANT_VERSION \"$$ver\"" >> include/version.h.new; \
+ echo "#define RADIANT_MAJOR_VERSION \"$$major\"" >> include/version.h.new; \
+ echo "#define RADIANT_MINOR_VERSION \"$$minor\"" >> include/version.h.new; \
+ echo "$$major" > include/RADIANT_MAJOR.new; \
+ echo "$$minor" > include/RADIANT_MINOR.new; \
+ echo "$$ver" > include/version.new; \
+ echo "// generated header, see Makefile" > include/aboutmsg.h.new; \
+ echo "#define RADIANT_ABOUTMSG \"$(RADIANT_ABOUTMSG)\"" >> include/aboutmsg.h.new; \
+ mv_if_diff() \
+ { \
+ if diff $$1 $$2 >/dev/null 2>&1; then \
+ rm -f $$1; \
+ else \
+ mv $$1 $$2; \
+ fi; \
+ }; \
+ mv_if_diff include/version.h.new include/version.h; \
+ mv_if_diff include/RADIANT_MAJOR.new include/RADIANT_MAJOR; \
+ mv_if_diff include/RADIANT_MINOR.new include/RADIANT_MINOR; \
+ mv_if_diff include/version.new include/version; \
+ mv_if_diff include/aboutmsg.h.new include/aboutmsg.h
.PHONY: install-data
-install-data:
+install-data: makeversion
$(MKDIR) install/games
+ $(FIND) install/ -name .svn -exec $(RM_R) {} \; -prune; \
set -ex; \
for GAME in games/*; do \
+ if [ -d "$$GAME/tools" ]; then \
+ GAME=$$GAME/tools; \
+ fi; \
for GAMEFILE in $$GAME/games/*.game; do \
$(CP) "$$GAMEFILE" install/games/; \
done; \