]> git.rm.cloudns.org Git - xonotic/netradiant.git/commitdiff
make the makefile a bit more customizable
authorrpolzer <rpolzer@61c419a2-8eb2-4b30-bcec-8cead039b335>
Tue, 16 Sep 2008 16:05:27 +0000 (16:05 +0000)
committerrpolzer <rpolzer@61c419a2-8eb2-4b30-bcec-8cead039b335>
Tue, 16 Sep 2008 16:05:27 +0000 (16:05 +0000)
git-svn-id: svn://svn.icculus.org/netradiant/trunk@63 61c419a2-8eb2-4b30-bcec-8cead039b335

Makefile
install-dlls.sh

index d07f20ee86dbf74b1c7b14b86c80d91669c06bd4..282200fc98b59de8ef06666addc53d7e81327c0e 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -20,6 +20,10 @@ RANLIB             ?= ranlib
 AR                 ?= ar
 MKDIR              ?= mkdir -p
 CP                 ?= cp
+CAT                ?= cat
+SH                 ?= sh
+ECHO               ?= echo
+DIFF               ?= diff
 CP_R               ?= $(CP) -r
 RM_R               ?= $(RM) -r
 PKGCONFIG          ?= pkg-config
@@ -42,6 +46,10 @@ CPPFLAGS_ZLIB      ?=
 LIBS_ZLIB          ?= -lz
 DEPEND_ON_MAKEFILE ?= yes
 
+# these are used on Win32 only
+GTKDIR             ?= `$(PKGCONFIG) gtk+-2.0 --variable=prefix`
+WHICHDLL           ?= which
+
 # alias mingw32 OSes
 ifeq ($(OS),MINGW32_NT-6.0)
        OS = Win32
@@ -719,21 +727,21 @@ install/heretic2/h2data.$(EXE): \
 .PHONY: makeversion
 makeversion:
        set -ex; \
-       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.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; \
+       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.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 \
+               if $(DIFF) $$1 $$2 >/dev/null 2>&1; then \
                        rm -f $$1; \
                else \
                        mv $$1 $$2; \
@@ -769,7 +777,7 @@ install-data: makeversion
 .PHONY: install-dll
 ifeq ($(OS),Win32)
 install-dll:
-       sh install-dlls.sh
+       WHICHDLL="$(WHICHDLL)" GTKDIR="$(GTKDIR)" CP="$(CP)" CAT="$(CAT)" MKDIR="$(MKDIR)" $(SH) install-dlls.sh
 else
 install-dll:
        echo No DLL inclusion required for this target.
index a7e096aa63d524ad33ae6ebb23a5943fa0612282..1ecbca6af6947f58504a38df77e4336c3217c6b2 100644 (file)
@@ -5,6 +5,8 @@ set -ex
 : ${WHICHDLL:=which}
 : ${GTKDIR:=/gtk}
 : ${CP:=cp}
+: ${CAT:=cat}
+: ${MKDIR:=mkdir -p}
 
 for DLL in \
        intl.dll \
@@ -28,9 +30,9 @@ for DLL in \
        $CP "`$WHICHDLL $DLL`" install/
 done
 
-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
-cat > install/etc/gtk-2.0/gdk-pixbuf.loaders <<'EOF'
+$CP "$GTKDIR/lib/gtk-2.0/2.10.0/loaders/libpixbufloader-bmp.dll" install/libgdk-win32-2.0-0-pixbufloader-bmp.dll
+$MKDIR install/etc/gtk-2.0
+$CAT > install/etc/gtk-2.0/gdk-pixbuf.loaders <<'EOF'
 # GdkPixbuf Image Loader Modules file
 #
 #