Menu

#3 Linux makefiles

open
nobody
None
5
2005-04-10
2005-04-10
Abc Def
No

Two makefiles for easy building Bindenlicht from
scratch, including downloading and building Irrlicht.
This includes two files, Makefile and cpp/Makefile.irrlicht

cpp/Makefile.irrlicht:

include Makefile

shared: $(LINKOBJ)
$(CPP) -L/usr/X11R6/lib -lGL -lGLU -lXxf86vm -shared
-fPIC $(LINKOBJ) zlib/libz.a jpeglib/libjpeg.a -o
libIrrlicht.so

Makefile:

#
# Makefile for Bindenlicht
#

# Location of server with copy of Irrlicht ZIP
# Official but most often overloaded server
#MIRROR_URL=ftp://ftp.sourceforge.net/i/ir/irrlicht/
# Unofficial, but more accessible server (NOT for heavy
usage!)
MIRROR_URL=ftp://yellowhedgehog.com/game_engines/irrlicht/ftp.sourceforge.net/i/ir/irrlicht/

# File name to download
IRRLICHT_ZIP=irrlicht-0.8.zip

# Directory where local copy of Irrlicht ZIP file will
be stored
LOCAL=local

all: media jni classes jar

rebuild: purge all

classes:
mkdir -p bin
javac -d bin bindenlicht/*.java
.PHONY: classes

jar: lib/bindenlicht.jar
.PHONY: jar

lib/bindenlicht.jar:
mkdir -p lib
cd bin; jar cvf ../lib/bindenlicht.jar `ls
bindenlicht/* | sort`

jni: libbindenlicht.so
.PHONY: jni

libbindenlicht.so: cpp/include/irrlicht.h
lib/libIrrlicht.so cpp/*cpp cpp/*h
cp lib/libIrrlicht.so cpp/
cd cpp ; make
mkdir -p lib
mv cpp/libbindenlicht.so lib/
rm -f cpp/libIrrlicht.so

#
# Irrlicht
#

$(LOCAL)/$(IRRLICHT_ZIP):
mkdir -p $(LOCAL)/
cd $(LOCAL) && wget $(MIRROR_URL)/$(IRRLICHT_ZIP)

irrlicht: lib/libIrrlicht.so
.PHONY: irrlicht

lib/libIrrlicht.so: $(LOCAL)/$(IRRLICHT_ZIP)
rm -f cpp/source.zip
unzip -j $(LOCAL)/$(IRRLICHT_ZIP)
'*/source/source.zip' -d cpp/
rm -rf cpp/Irrlicht
unzip cpp/source.zip Irrlicht/* -d cpp/
rm -f cpp/source.zip
cp cpp/Makefile.irrlicht cpp/Irrlicht/
cd cpp/Irrlicht/ && make -f Makefile.irrlicht shared
mv cpp/Irrlicht/libIrrlicht.so lib/

irr_headers: cpp/include/irrlicht.h
.PHONY: irr_headers

cpp/include/irrlicht.h: $(LOCAL)/$(IRRLICHT_ZIP)
rm -rf cpp/include/
mkdir -p cpp/include
unzip -j $(LOCAL)/$(IRRLICHT_ZIP) '*/include/*' -d
cpp/include
touch cpp/include/* # make them more recent than
Irrlicht ZIP

irr_media: media/irrlichtlogo.jpg
.PHONY: irr_media

media/irrlichtlogo.jpg: $(LOCAL)/$(IRRLICHT_ZIP)
rm -rf media/
mkdir -p media
unzip -j $(LOCAL)/$(IRRLICHT_ZIP) '*/media/*' -d media/
touch media/* # make them more recent than Irrlicht ZIP

#
# Maintenance
#

clean:
rm -rf bin/
rm -f bindenlicht/.#*.java
rm -f bindenlicht/*~
rm -f cpp/*~
rm -f *~
rm -rf cpp/tmp/
cd cpp && make clean
$(shell cd cpp/Irrlicht && make clean)
.PHONY: clean

purge: clean
rm -rf $(LOCAL)/$(IRRLICHT_ZIP)
rmdir --ignore-fail-on-non-empty $(LOCAL)
rm -f cpp/*so
rm -rf cpp/include
rm -rf cpp/Irrlicht
rm -f lib/libIrrlicht.so
rm -f lib/libbindenlicht.so
rm -f lib/bindenlicht.jar
.PHONY: purge

Discussion


Log in to post a comment.

MongoDB Logo MongoDB