make the makefile a bit more customizable

git-svn-id: svn://svn.icculus.org/netradiant/trunk@63 61c419a2-8eb2-4b30-bcec-8cead039b335
This commit is contained in:
rpolzer 2008-09-16 16:05:27 +00:00
parent 0c406924dc
commit 96769b5269
2 changed files with 27 additions and 17 deletions

View File

@ -20,6 +20,10 @@ RANLIB ?= ranlib
AR ?= ar AR ?= ar
MKDIR ?= mkdir -p MKDIR ?= mkdir -p
CP ?= cp CP ?= cp
CAT ?= cat
SH ?= sh
ECHO ?= echo
DIFF ?= diff
CP_R ?= $(CP) -r CP_R ?= $(CP) -r
RM_R ?= $(RM) -r RM_R ?= $(RM) -r
PKGCONFIG ?= pkg-config PKGCONFIG ?= pkg-config
@ -42,6 +46,10 @@ CPPFLAGS_ZLIB ?=
LIBS_ZLIB ?= -lz LIBS_ZLIB ?= -lz
DEPEND_ON_MAKEFILE ?= yes DEPEND_ON_MAKEFILE ?= yes
# these are used on Win32 only
GTKDIR ?= `$(PKGCONFIG) gtk+-2.0 --variable=prefix`
WHICHDLL ?= which
# alias mingw32 OSes # alias mingw32 OSes
ifeq ($(OS),MINGW32_NT-6.0) ifeq ($(OS),MINGW32_NT-6.0)
OS = Win32 OS = Win32
@ -719,21 +727,21 @@ install/heretic2/h2data.$(EXE): \
.PHONY: makeversion .PHONY: makeversion
makeversion: makeversion:
set -ex; \ set -ex; \
ver=`cat include/version.default`; \ ver=`$(CAT) include/version.default`; \
major=`echo $$ver | cut -d . -f 2`; \ major=`$(ECHO) $$ver | cut -d . -f 2`; \
minor=`echo $$ver | cut -d . -f 3 | cut -d - -f 1`; \ minor=`$(ECHO) $$ver | cut -d . -f 3 | cut -d - -f 1`; \
echo "// generated header, see Makefile" > include/version.h.new; \ $(ECHO) "// generated header, see Makefile" > include/version.h.new; \
echo "#define RADIANT_VERSION \"$$ver\"" >> 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_MAJOR_VERSION \"$$major\"" >> include/version.h.new; \
echo "#define RADIANT_MINOR_VERSION \"$$minor\"" >> include/version.h.new; \ $(ECHO) "#define RADIANT_MINOR_VERSION \"$$minor\"" >> include/version.h.new; \
echo "$$major" > include/RADIANT_MAJOR.new; \ $(ECHO) "$$major" > include/RADIANT_MAJOR.new; \
echo "$$minor" > include/RADIANT_MINOR.new; \ $(ECHO) "$$minor" > include/RADIANT_MINOR.new; \
echo "$$ver" > include/version.new; \ $(ECHO) "$$ver" > include/version.new; \
echo "// generated header, see Makefile" > include/aboutmsg.h.new; \ $(ECHO) "// generated header, see Makefile" > include/aboutmsg.h.new; \
echo "#define RADIANT_ABOUTMSG \"$(RADIANT_ABOUTMSG)\"" >> include/aboutmsg.h.new; \ $(ECHO) "#define RADIANT_ABOUTMSG \"$(RADIANT_ABOUTMSG)\"" >> include/aboutmsg.h.new; \
mv_if_diff() \ mv_if_diff() \
{ \ { \
if diff $$1 $$2 >/dev/null 2>&1; then \ if $(DIFF) $$1 $$2 >/dev/null 2>&1; then \
rm -f $$1; \ rm -f $$1; \
else \ else \
mv $$1 $$2; \ mv $$1 $$2; \
@ -769,7 +777,7 @@ install-data: makeversion
.PHONY: install-dll .PHONY: install-dll
ifeq ($(OS),Win32) ifeq ($(OS),Win32)
install-dll: install-dll:
sh install-dlls.sh WHICHDLL="$(WHICHDLL)" GTKDIR="$(GTKDIR)" CP="$(CP)" CAT="$(CAT)" MKDIR="$(MKDIR)" $(SH) install-dlls.sh
else else
install-dll: install-dll:
echo No DLL inclusion required for this target. echo No DLL inclusion required for this target.

View File

@ -5,6 +5,8 @@ set -ex
: ${WHICHDLL:=which} : ${WHICHDLL:=which}
: ${GTKDIR:=/gtk} : ${GTKDIR:=/gtk}
: ${CP:=cp} : ${CP:=cp}
: ${CAT:=cat}
: ${MKDIR:=mkdir -p}
for DLL in \ for DLL in \
intl.dll \ intl.dll \
@ -28,9 +30,9 @@ for DLL in \
$CP "`$WHICHDLL $DLL`" install/ $CP "`$WHICHDLL $DLL`" install/
done done
cp "$GTKDIR/lib/gtk-2.0/2.10.0/loaders/libpixbufloader-bmp.dll" install/libgdk-win32-2.0-0-pixbufloader-bmp.dll $CP "$GTKDIR/lib/gtk-2.0/2.10.0/loaders/libpixbufloader-bmp.dll" install/libgdk-win32-2.0-0-pixbufloader-bmp.dll
mkdir -p install/etc/gtk-2.0 $MKDIR install/etc/gtk-2.0
cat > install/etc/gtk-2.0/gdk-pixbuf.loaders <<'EOF' $CAT > install/etc/gtk-2.0/gdk-pixbuf.loaders <<'EOF'
# GdkPixbuf Image Loader Modules file # GdkPixbuf Image Loader Modules file
# #
# #