File: Makefile

package info (click to toggle)
libmatthew-java 0.8.1-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 432 kB
  • sloc: java: 2,076; ansic: 361; makefile: 141
file content (143 lines) | stat: -rw-r--r-- 5,054 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
JAVAC?=javac
JAVADOC?=javadoc
JAR?=jar
JAVAH?=javah
GCJ?=gcj
CC?=gcc
LD?=gcc
JPPFLAGS+=-C -P
CFLAGS+=-Wall -Os -pedantic -Werror
CSTD?=-std=c99
CSHAREFLAG+=-fpic -fno-stack-protector
GCJJNIFLAG=-fjni
JVERCFLAGS+=-source 1.5
JCFLAGS+=
INCLUDES+=-I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/linux
JAVADOCFLAGS?=-quiet -author -link http://java.sun.com/j2se/1.4.2/docs/api/

LDVER?=$(shell ld -v | cut -d' ' -f1)
UNAME?=$(shell uname -s)

ifeq ($(LDVER),GNU)
LDSHAREFLAGS+=-fpic -shared
else
LDSHAREFLAGS+=-lc
endif

PREFIX?=/usr/local
JARDIR?=$(PREFIX)/share/java
DOCDIR?=$(PREFIX)/share/doc/libmatthew-java/
LIBDIR?=$(PREFIX)/lib/jni

MATTVER=0.8.1
DEBUGVER=1.1
UNIXVER=0.5
CGIVER=0.6
IOVER=0.1
HEXVER=0.2

SRC=$(shell find cx -name '*.java' -and -not -name 'Debug.java')

DEBUG?=disable

.NOPARALLEL:
.NO_PARALLEL:
.NOTPARALLEL:

all: unix-$(UNIXVER).jar cgi-$(CGIVER).jar debug-enable-$(DEBUGVER).jar debug-disable-$(DEBUGVER).jar io-$(IOVER).jar hexdump-$(HEXVER).jar libcgi-java.so libunix-java.so

dist: libmatthew-java-$(MATTVER).tar.gz

classes: .classes 
.classes: $(SRC) 
	mkdir -p classes
	$(MAKE) .$(DEBUG)debug
	$(JAVAC) $(JVERCFLAGS) $(JCFLAGS) -d classes -cp classes $^
	touch .classes
clean:
	rm -rf classes doc
	rm -f .classes .enabledebug .disabledebug *.o *.so *.tar.gz *.jar *.cgi Manifest
	rm -rf libmatthew-java-$(MATTVER)

cgi-$(CGIVER).jar: .classes
	(cd classes; $(JAR) cf ../$@ cx/ath/matthew/cgi/*class)
io-$(IOVER).jar: .classes
	(cd classes; $(JAR) cf ../$@ cx/ath/matthew/io/*class)
unix-$(UNIXVER).jar: .classes
ifeq ($(DEBUG),enable)
	echo "Class-Path: debug-$(DEBUG).jar" > Manifest
else
	echo "Class-Path: " > Manifest
endif
	(cd classes; $(JAR) cfm ../$@ ../Manifest cx/ath/matthew/unix/*class)

hexdump-$(HEXVER).jar: .classes
	(cd classes; $(JAR) cf ../$@ cx/ath/matthew/utils/Hexdump.class)

%.o: %.c %.h
	$(CC) $(CFLAGS) $(CSTD) $(CSHAREFLAG) $(INCLUDES) -c -o $@ $<
lib%.so: %.o
	$(CC) $(LDFLAGS) $(LDSHAREFLAGS) -o $@ $<
headers: .classes
	$(JAVAH) -classpath classes -o $@ cx.ath.matthew.unix.UnixServerSocket cx.ath.matthew.unix.UnixSocket cx.ath.matthew.unix.USInputStream cx.ath.matthew.unix.USOutputStream
	$(JAVAH) -classpath classes -o $@ cx.ath.matthew.cgi.CGI

test.cgi: cgi-$(CGIVER).jar libcgi-java.so
	$(GCJ) $(GCJFLAGS) $(GCJJNIFLAG) -L. -lcgi-java -o test.cgi --main=cx.ath.matthew.cgi.testcgi cgi-$(CGIVER).jar
	
libmatthew-java-$(MATTVER).tar.gz: Makefile cx cgi-java.c unix-java.c README INSTALL COPYING changelog unix-java.h cgi-java.h
	mkdir -p libmatthew-java-$(MATTVER)
	cp -a $^ libmatthew-java-$(MATTVER)
	tar zcf $@ libmatthew-java-$(MATTVER)

debug-enable-$(DEBUGVER).jar: cx/ath/matthew/debug/Debug.jpp
	make .enabledebug
	echo "Class-Path: hexdump.jar" > Manifest
	(cd classes;jar cfm ../$@ ../Manifest cx/ath/matthew/debug/*.class)
debug-disable-$(DEBUGVER).jar: cx/ath/matthew/debug/Debug.jpp
	make .disabledebug
	echo "Class-Path: hexdump.jar" > Manifest
	(cd classes;jar cfm ../$@ ../Manifest cx/ath/matthew/debug/*.class)
.enabledebug: cx/ath/matthew/debug/Debug.jpp 
	mkdir -p classes
	cpp $(PPFLAGS) $(JPPFLAGS) -DDEBUGSETTING=true < cx/ath/matthew/debug/Debug.jpp > cx/ath/matthew/debug/Debug.java
	$(JAVAC) $(JVERCFLAGS) $(JCFLAGS) -cp classes -d classes cx/ath/matthew/debug/Debug.java cx/ath/matthew/utils/Hexdump.java
	rm -f .disabledebug
	touch .enabledebug
.disabledebug: cx/ath/matthew/debug/Debug.jpp 
	mkdir -p classes
	cpp $(PPFLAGS) $(JPPFLAGS) -DDEBUGSETTING=false < cx/ath/matthew/debug/Debug.jpp > cx/ath/matthew/debug/Debug.java
	$(JAVAC) $(JVERCFLAGS) $(JCFLAGS) -cp classes -d classes cx/ath/matthew/debug/Debug.java cx/ath/matthew/utils/Hexdump.java
	rm -f .enabledebug
	touch .disabledebug
cx/ath/matthew/debug/Debug.java: .disabledebug
doc/index.html: 
	$(JAVADOC) $(JAVADOCFLAGS) -d doc/ cx/ath/matthew/debug/Debug.java $(SRC)

doc: doc/index.html

install-doc: doc/index.html
	install -d $(DESTDIR)$(DOCDIR)
	cp -a doc $(DESTDIR)$(DOCDIR)/api

install-native: libcgi-java.so libunix-java.so 
	install -d $(DESTDIR)$(LIBDIR) 
	install libcgi-java.so $(DESTDIR)$(LIBDIR)
	install libunix-java.so $(DESTDIR)$(LIBDIR)

install-jar: unix-$(UNIXVER).jar cgi-$(CGIVER).jar debug-enable-$(DEBUGVER).jar debug-disable-$(DEBUGVER).jar io-$(IOVER).jar hexdump-$(HEXVER).jar
	install -d $(DESTDIR)$(JARDIR)
	install -m 644 debug-enable-$(DEBUGVER).jar $(DESTDIR)$(JARDIR)
	install -m 644 debug-disable-$(DEBUGVER).jar $(DESTDIR)$(JARDIR)
	install -m 644 unix-$(UNIXVER).jar $(DESTDIR)$(JARDIR)
	install -m 644 cgi-$(CGIVER).jar $(DESTDIR)$(JARDIR)
	install -m 644 io-$(IOVER).jar $(DESTDIR)$(JARDIR)
	install -m 644 hexdump-$(HEXVER).jar $(DESTDIR)$(JARDIR)
	ln -sf debug-disable-$(DEBUGVER).jar $(DESTDIR)$(JARDIR)/debug-disable.jar
	ln -sf debug-enable-$(DEBUGVER).jar $(DESTDIR)$(JARDIR)/debug-enable.jar
	ln -sf unix-$(UNIXVER).jar $(DESTDIR)$(JARDIR)/unix.jar
	ln -sf io-$(IOVER).jar $(DESTDIR)$(JARDIR)/io.jar
	ln -sf cgi-$(CGIVER).jar $(DESTDIR)$(JARDIR)/cgi.jar
	ln -sf hexdump-$(HEXVER).jar $(DESTDIR)$(JARDIR)/hexdump.jar

install: install-native install-jar