summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorMatthew Johnson <mjj29@hecate.trinhall.cam.ac.uk>2006-11-27 12:22:27 +0000
committerMatthew Johnson <mjj29@hecate.trinhall.cam.ac.uk>2006-11-27 12:22:27 +0000
commit1a0cfae86dbe8c11270df6df395ec23691116def (patch)
treef0e2fe204768b6929775d2bf19d36f6325f5b2b9 /Makefile
parentfb4193a43d30f2415e91b0b4e27eca7645f9dda1 (diff)
change build system to fix bsd bugs and use DESTDIR properly. Move everything around somewhat
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile137
1 files changed, 69 insertions, 68 deletions
diff --git a/Makefile b/Makefile
index 713a141..0ea938d 100644
--- a/Makefile
+++ b/Makefile
@@ -7,56 +7,61 @@
# Variables controlling compilation. May be overridden on the command line for
# debug builds etc
-#
+
+# Programs
JAVAC?=javac
JAVA?=java
JAVAH?=javah
JAVADOC?=javadoc
JAR?=jar
+MAKE?=make
+CC?=gcc
+LD?=ld
+STRIP?=strip
+
+# Program parameters
INCLUDES?=`pkg-config --cflags dbus-1` -I${JAVA_HOME}/include -I${JAVA_HOME}/include/linux
CFLAGS?= -Os -Wall -Werror -pedantic -std=c99
CFLAGS+=$(INCLUDES)
CFLAGS+=$(call cc-option,-fno-stack-protector,)
LIBS?=`pkg-config --libs dbus-1`
-CC?=gcc
-LD?=ld
-STRIP?=strip
CPFLAG?=-classpath
JCFLAGS?=-Xlint:all -O -g:none
JCFLAGS+=-cp classes:$(CLASSPATH)
-JFLAGS+=-Djava.library.path=.:/usr/lib
+JFLAGS+=-Djava.library.path=.:$(DBUSLIBDIR)
+
+# Source/Class locations
SRCDIR=org/freedesktop
CLASSDIR=classes/org/freedesktop/dbus
# Installation variables. Controls the location of make install. May be
# overridden in the make command line to install to different locations
#
-PREFIX?=$(DESTDIR)/usr/local
+PREFIX?=/usr/local
JARPREFIX?=$(PREFIX)/share/java
LIBPREFIX?=$(PREFIX)/lib/jni
BINPREFIX?=$(PREFIX)/bin
DOCPREFIX?=$(PREFIX)/share/doc/libdbus-java
MANPREFIX?=$(PREFIX)/share/man/man1
-RUNPREFIX?=$(PREFIX)
-RUNJARPREFIX?=$(RUNPREFIX)/share/java
-RUNLIBPREFIX?=$(RUNPREFIX)/lib/jni
+# Installation directory of the D-Bus libraries
+DBUSLIBDIR?=/usr/lib
+
+# Version numbering
VERSION = 1.13
RELEASEVERSION = 1.12
# Usage: cflags-y += $(call cc-option, -march=winchip-c6, -march=i586)
cc-option = $(shell if $(CC) $(1) -S -o /dev/null -xc /dev/null \
> /dev/null 2>&1; then echo "$(1)"; else echo "$(2)"; fi ;)
-
-all: libdbus-java.so libdbus-java-$(VERSION).jar dbus-java-viewer-$(VERSION).jar
+all: libdbus-java.so libdbus-java-$(VERSION).jar dbus-java-viewer-$(VERSION).jar bin/ListDBus bin/CreateInterface bin/DBusViewer
clean:
- rm -rf doc
- rm -rf classes
+ rm -rf doc bin classes
+ rm -f *.1 *.o *.so *.h .dist .classes .testclasses .doc *.jar *.log pid address tmp-session-bus *.gz .viewerclasses .bin
rm -rf libdbus-$(VERSION)
rm -rf libdbus-$(RELEASEVERSION)
- rm -f *.1 *.o *.so *.h .dist .classes .testclasses .doc *.jar *.log pid address tmp-session-bus *.gz .viewerclasses
classes: .classes
testclasses: .testclasses
@@ -74,19 +79,13 @@ viewerclasses: .viewerclasses
$(JAVAC) -d classes $(JCFLAGS) $^
touch .classes
-$(CLASSDIR)/DBusConnection.class: $(SRCDIR)/dbus/DBusConnection.java
- make classes
-$(CLASSDIR)/DBusErrorMessage.class: $(SRCDIR)/dbus/DBusErrorMessage.java
- make classes
-$(CLASSDIR)/MethodCall.class: $(SRCDIR)/dbus/MethodCall.java
- make classes
-org_freedesktop_dbus_DBusConnection.h: $(CLASSDIR)/DBusConnection.class
+org_freedesktop_dbus_DBusConnection.h: .classes
$(JAVAH) -classpath classes:$(CLASSPATH) -d . org.freedesktop.dbus.DBusConnection
touch $@
-org_freedesktop_dbus_DBusErrorMessage.h: $(CLASSDIR)/DBusErrorMessage.class
+org_freedesktop_dbus_DBusErrorMessage.h: .classes
$(JAVAH) -classpath classes:$(CLASSPATH) -d . org.freedesktop.dbus.DBusErrorMessage
touch $@
-org_freedesktop_dbus_MethodCall.h: $(CLASSDIR)/MethodCall.class
+org_freedesktop_dbus_MethodCall.h: .classes
$(JAVAH) -classpath classes:$(CLASSPATH) -d . org.freedesktop.dbus.MethodCall
touch $@
dbus-java.o: dbus-java.c org_freedesktop_dbus_DBusConnection.h org_freedesktop_dbus_DBusErrorMessage.h org_freedesktop_dbus_MethodCall.h
@@ -102,13 +101,15 @@ dbus-java-test-$(VERSION).jar: .testclasses
dbus-java-viewer-$(VERSION).jar: .viewerclasses
(cd classes; $(JAR) -cf ../$@ org/freedesktop/dbus/viewer/*.class)
-
jar: libdbus-java-$(VERSION).jar
doc: doc/dbus-java.dvi doc/dbus-java.ps doc/dbus-java.pdf doc/dbus-java/index.html doc/api/index.html
.doc:
mkdir -p doc
mkdir -p doc/dbus-java
touch .doc
+.bin:
+ mkdir -p bin
+ touch .bin
doc/dbus-java.dvi: dbus-java.tex .doc
(cd doc; latex ../dbus-java.tex)
(cd doc; latex ../dbus-java.tex)
@@ -128,6 +129,9 @@ doc/api/index.html: $(SRCDIR)/*.java $(SRCDIR)/dbus/*.java .doc
%.1: %.sgml
docbook-to-man $< > $@
+bin/%: %.sh .bin
+ sed 's,\%JARPATH\%,$(JARPREFIX),;s,\%LIBPATH\%,$(LIBPREFIX),;s,\%DBUSLIBPATH\%,$(DBUSLIBDIR),' < $< > $@
+
testrun: libdbus-java.so libdbus-java-$(VERSION).jar dbus-java-test-$(VERSION).jar
$(JAVA) $(JFLAGS) $(CPFLAG) $(CLASSPATH):libdbus-java-$(VERSION).jar:dbus-java-test-$(VERSION).jar org.freedesktop.dbus.test.test
@@ -154,7 +158,7 @@ check:
dbus-daemon --config-file=tmp-session.conf --print-pid --print-address=5 --fork >pid 5>address ; \
export DBUS_SESSION_BUS_ADDRESS=$$(cat address) ;\
dbus-monitor &> monitor.log & \
- if make testrun ; then export PASS=true; fi ; \
+ if $(MAKE) testrun ; then export PASS=true; fi ; \
kill $$(cat pid) ; \
if [[ "$$PASS" == "true" ]]; then exit 0; else exit 1; fi )
@@ -163,71 +167,68 @@ cross-test-compile: libdbus-java.so libdbus-java-$(VERSION).jar dbus-java-test-$
internal-cross-test: libdbus-java.so libdbus-java-$(VERSION).jar dbus-java-test-$(VERSION).jar
( dbus-daemon --config-file=tmp-session.conf --print-pid --print-address=5 --fork >pid 5>address ; \
export DBUS_SESSION_BUS_ADDRESS=$$(cat address) ;\
- make -s cross-test-server > server.log &\
- make -s cross-test-client > client.log ;\
+ $(MAKE) -s cross-test-server > server.log &\
+ $(MAKE) -s cross-test-client > client.log ;\
kill $$(cat pid) ; )
two-part-test: libdbus-java.so libdbus-java-$(VERSION).jar dbus-java-test-$(VERSION).jar
( dbus-daemon --config-file=tmp-session.conf --print-pid --print-address=5 --fork >pid 5>address ; \
export DBUS_SESSION_BUS_ADDRESS=$$(cat address) ;\
- make -s two-part-server | tee server.log &\
+ $(MAKE) -s two-part-server | tee server.log &\
sleep 1;\
- make -s two-part-client | tee client.log ;\
+ $(MAKE) -s two-part-client | tee client.log ;\
kill $$(cat pid) ; )
profile:
( PASS=false; \
dbus-daemon --config-file=tmp-session.conf --print-pid --print-address=5 --fork >pid 5>address ; \
export DBUS_SESSION_BUS_ADDRESS=$$(cat address) ;\
- if make profilerun ; then export PASS=true; fi ; \
+ if $(MAKE) profilerun ; then export PASS=true; fi ; \
kill $$(cat pid) ; \
if [[ "$$PASS" == "true" ]]; then exit 0; else exit 1; fi )
uninstall:
- rm -f $(JARPREFIX)/dbus.jar $(JARPREFIX)/dbus-$(VERSION).jar $(JARPREFIX)/dbus-viewer.jar $(JARPREFIX)/dbus-viewer-$(VERSION).jar
- rm -f $(LIBPREFIX)/libdbus-java.so
- rm -rf $(DOCPREFIX)
- rm -f $(MANPREFIX)/CreateInterface.1 $(MANPREFIX)/ListDBus.1 $(MANPREFIX)/DBusViewer.1
- rm -f $(BINPREFIX)/CreateInterface $(BINPREFIX)/ListDBus $(BINPREFIX)/DBusViewer
+ rm -f $(DESTDIR)$(JARPREFIX)/dbus.jar $(DESTDIR)$(JARPREFIX)/dbus-$(VERSION).jar $(DESTDIR)$(JARPREFIX)/dbus-viewer.jar $(DESTDIR)$(JARPREFIX)/dbus-viewer-$(VERSION).jar
+ rm -f $(DESTDIR)$(LIBPREFIX)/libdbus-java.so
+ rm -rf $(DESTDIR)$(DOCPREFIX)
+ rm -f $(DESTDIR)$(MANPREFIX)/CreateInterface.1 $(DESTDIR)$(MANPREFIX)/ListDBus.1 $(DESTDIR)$(MANPREFIX)/DBusViewer.1
+ rm -f $(DESTDIR)$(BINPREFIX)/CreateInterface $(DESTDIR)$(BINPREFIX)/ListDBus $(DESTDIR)$(BINPREFIX)/DBusViewer
install: dbus-java-viewer-$(VERSION).jar libdbus-java-$(VERSION).jar libdbus-java.so bin/CreateInterface bin/ListDBus bin/DBusViewer
- install -d $(JARPREFIX)
- install -m 644 libdbus-java-$(VERSION).jar $(JARPREFIX)/dbus-$(VERSION).jar
- install -m 644 dbus-java-viewer-$(VERSION).jar $(JARPREFIX)/dbus-viewer-$(VERSION).jar
- ln -sf dbus-$(VERSION).jar $(JARPREFIX)/dbus.jar
- ln -sf dbus-viewer-$(VERSION).jar $(JARPREFIX)/dbus-viewer.jar
- install -d $(LIBPREFIX)
- install libdbus-java.so $(LIBPREFIX)
- install -d $(BINPREFIX)
- sed 's,\%JARPATH\%,$(RUNJARPREFIX),;s,\%LIBPATH\%,$(RUNLIBPREFIX),' < bin/DBusViewer > $(BINPREFIX)/DBusViewer
- chmod +x $(BINPREFIX)/DBusViewer
- sed 's,\%JARPATH\%,$(RUNJARPREFIX),;s,\%LIBPATH\%,$(RUNLIBPREFIX),' < bin/CreateInterface > $(BINPREFIX)/CreateInterface
- chmod +x $(BINPREFIX)/CreateInterface
- sed 's,\%JARPATH\%,$(RUNJARPREFIX),;s,\%LIBPATH\%,$(RUNLIBPREFIX),' < bin/ListDBus > $(BINPREFIX)/ListDBus
- chmod +x $(BINPREFIX)/ListDBus
+ install -d $(DESTDIR)$(JARPREFIX)
+ install -m 644 libdbus-java-$(VERSION).jar $(DESTDIR)$(JARPREFIX)/dbus-$(VERSION).jar
+ install -m 644 dbus-java-viewer-$(VERSION).jar $(DESTDIR)$(JARPREFIX)/dbus-viewer-$(VERSION).jar
+ ln -sf dbus-$(VERSION).jar $(DESTDIR)$(JARPREFIX)/dbus.jar
+ ln -sf dbus-viewer-$(VERSION).jar $(DESTDIR)$(JARPREFIX)/dbus-viewer.jar
+ install -d $(DESTDIR)$(LIBPREFIX)
+ install libdbus-java.so $(DESTDIR)$(LIBPREFIX)
+ install -d $(DESTDIR)$(BINPREFIX)
+ install bin/DBusViewer $(DESTDIR)$(BINPREFIX)
+ install bin/CreateInterface $(DESTDIR)$(BINPREFIX)
+ install bin/ListDBus $(DESTDIR)$(BINPREFIX)
install-man: CreateInterface.1 ListDBus.1 DBusViewer.1 changelog AUTHORS COPYING README INSTALL
- install -d $(DOCPREFIX)
- install -m 644 changelog $(DOCPREFIX)
- install -m 644 COPYING $(DOCPREFIX)
- install -m 644 AUTHORS $(DOCPREFIX)
- install -m 644 README $(DOCPREFIX)
- install -m 644 INSTALL $(DOCPREFIX)
- install -d $(MANPREFIX)
- install -m 644 CreateInterface.1 $(MANPREFIX)/CreateInterface.1
- install -m 644 ListDBus.1 $(MANPREFIX)/ListDBus.1
- install -m 644 DBusViewer.1 $(MANPREFIX)/DBusViewer.1
+ install -d $(DESTDIR)$(DOCPREFIX)
+ install -m 644 changelog $(DESTDIR)$(DOCPREFIX)
+ install -m 644 COPYING $(DESTDIR)$(DOCPREFIX)
+ install -m 644 AUTHORS $(DESTDIR)$(DOCPREFIX)
+ install -m 644 README $(DESTDIR)$(DOCPREFIX)
+ install -m 644 INSTALL $(DESTDIR)$(DOCPREFIX)
+ install -d $(DESTDIR)$(MANPREFIX)
+ install -m 644 CreateInterface.1 $(DESTDIR)$(MANPREFIX)/CreateInterface.1
+ install -m 644 ListDBus.1 $(DESTDIR)$(MANPREFIX)/ListDBus.1
+ install -m 644 DBusViewer.1 $(DESTDIR)$(MANPREFIX)/DBusViewer.1
install-doc: doc
- install -d $(DOCPREFIX)
- install -m 644 doc/dbus-java.dvi $(DOCPREFIX)
- install -m 644 doc/dbus-java.ps $(DOCPREFIX)
- install -m 644 doc/dbus-java.pdf $(DOCPREFIX)
- install -d $(DOCPREFIX)/dbus-java
- install -m 644 doc/dbus-java/*.html $(DOCPREFIX)/dbus-java
- install -m 644 doc/dbus-java/*.css $(DOCPREFIX)/dbus-java
- install -d $(DOCPREFIX)/api
- cp -a doc/api/* $(DOCPREFIX)/api
+ install -d $(DESTDIR)$(DOCPREFIX)
+ install -m 644 doc/dbus-java.dvi $(DESTDIR)$(DOCPREFIX)
+ install -m 644 doc/dbus-java.ps $(DESTDIR)$(DOCPREFIX)
+ install -m 644 doc/dbus-java.pdf $(DESTDIR)$(DOCPREFIX)
+ install -d $(DESTDIR)$(DOCPREFIX)/dbus-java
+ install -m 644 doc/dbus-java/*.html $(DESTDIR)$(DOCPREFIX)/dbus-java
+ install -m 644 doc/dbus-java/*.css $(DESTDIR)$(DOCPREFIX)/dbus-java
+ install -d $(DESTDIR)$(DOCPREFIX)/api
+ cp -a doc/api/* $(DESTDIR)$(DOCPREFIX)/api
dist: .dist
.dist: bin dbus-java.c dbus-java.tex Makefile org tmp-session.conf CreateInterface.sgml ListDBus.sgml DBusViewer.sgml changelog AUTHORS COPYING README INSTALL