File: Makefile.am

package info (click to toggle)
coin2 2.5.0-2
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 29,156 kB
  • ctags: 29,453
  • sloc: cpp: 175,383; ansic: 42,198; sh: 9,377; makefile: 7,260; perl: 990; yacc: 181; lex: 114
file content (125 lines) | stat: -rw-r--r-- 3,692 bytes parent folder | download | duplicates (2)
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

if BUILD_WITH_MSVC
cxxwrap_exe = $(top_srcdir)/cfg/cxxwrap.exe
else
cxxwrap_exe = ../tools/cxxwrap-*/cxxwrap
endif

all-local: java
	@echo "Java-wrapper build successful..."

headers.tar:
	builddir=`pwd`; \
	tmpdir=/tmp/coinjava; \
	rm -rf $$tmpdir; \
	mkdir $$tmpdir; \
	( cd ..; DESTDIR=$$tmpdir $(MAKE) install-data ); \
	( cd $$tmpdir/$(includedir); tar cf $$builddir/headers.tar * ); \
	rm -rf $$tmpdir;

headerlist.txt: headers.tar Makefile
	echo Inventor/C/basic.h >headerlist.txt
	tar tf headers.tar \
	  | grep "\.h\$$" \
	  | egrep -v "(SbOctTree\.h|SbHeap\.h|SbPList\.h|SbTesselator\.h|Inventor/C)" \
	  | egrep -v "(fields/So.*Long.h|elements/)" \
	  >>headerlist.txt

#	  | egrep -v "(SoGLNormalizeElement|SoGLShadeModelElement|SoLongElement)"

prep-done.txt: headerlist.txt $(top_srcdir)/scripts/prep.pl
	srcdir=`cd $(srcdir); pwd`; \
	topsrcdir=`cd $(top_srcdir); pwd`; \
	rm -rf include-pre; \
	mkdir include-pre; \
	rm -rf include-post; \
	mkdir include-post; \
	( cd include-pre; tar xf ../headers.tar ); \
	( cd include-pre; patch -p0 <$$srcdir/headers.patch ); \
	cppflags="`echo $(CPPFLAGS) | sed -e 's,-DCOIN_INTERNAL,,g'`"; \
	cat headerlist.txt \
	  | ( cd include-pre; \
	      $$topsrcdir/scripts/prep.pl \
	        --cpp="$(CXXCPP) $$cppflags" \
	        --destdir=../include-post );
	( cd include-post/Inventor; \
	  mv SoInput.h SoInput.h.old; \
	  sed -e 's, setBuffer(void \* bufpointer, setBuffer(char * bufpointer,g' SoInput.h.old > SoInput.h )
	touch prep-done.txt

cxxwrap.log: prep-done.txt
	srcdir=`cd $(srcdir); pwd`; \
	cxxwrap=`echo $(cxxwrap_exe)`; \
	topsrcdir=`cd $(top_srcdir); pwd`; \
	$$cxxwrap \
	  --root=include-post \
	  --classpath=jni/src \
	  --files=headerlist.txt \
	  --jni \
	  --jni-callbacks \
	  --jni-attributes \
	  --jni-operators \
	  --jni-expand-defaults \
	  --package-prefix=org.coin3d \
	  --verbose >cxxwrap.log;
	echo "TODO: Should patch jni/src/org/coin3d/Inventor/SoInput_jni.cxx here" 
	cp $(srcdir)/files/SoSceneManager_jni.cxx jni/src/org/coin3d/Inventor/
	cp $(srcdir)/files/hash_adt.h jni/src/org/coin3d/
	cp $(srcdir)/files/hash_adt.cxx jni/src/org/coin3d/
	cp $(srcdir)/files/RefQ.java jni/src/org/coin3d/
	cp $(srcdir)/files/Deletable.java jni/src/org/coin3d/

sources := $(shell find jni -iregex .\*\\.cxx | grep -v UnitData\$)
objects := $(patsubst %.cxx,%.o,$(sources))

if BUILD_WITH_MSVC
LIBRARY = jni/CoinJava.dll
COIN_LIB = -lcoin2
$(LIBRARY)-real: $(objects)
	@echo Linking dll...
	$(CXX) $(LDFLAGS) -DLL /INCREMENTAL:NO /RELEASE -L../src /OUT:$(LIBRARY) $(objects) $(COIN_LIB)
else
LIBRARY = jni/libCoinJava.so
$(LIBRARY)-real: $(objects)
	@echo Linking shared library...
	$(CXX) $(LDFLAGS) -shared -Wl,-soname,$(LIBRARY) $(objects) $(COIN_LIB) -o $(LIBRARY)
endif

# need to re-invoke make to get $(objects) filled
$(LIBRARY):
	$(MAKE) $(LIBRARY)-real

$(objects): %.o: %.cxx
	$(CXX) -I. -I$(top_builddir)/include -I$(top_srcdir)/include $(COIN_EXTRA_CPPFLAGS) -c $< -o $@

#	$(CXX) -DJNIEXPORT="__declspec(dllexport)" -I. -I$(top_builddir)/include -I$(top_srcdir)/include $(COIN_EXTRA_CPPFLAGS) -c $< -o $@

native: cxxwrap.log $(LIBRARY)

JARFILE = jni/CoinJava.jar

JAVAC = javac
JAR = jar

$(JARFILE):
	mkdir -p jni/java-build
	find jni/src -iregex ".*\.java$$" > jni/JAVA-SOURCES.LST
	$(JAVAC) -sourcepath jni/src -d jni/java-build @jni/JAVA-SOURCES.LST
	$(JAR) cf $(JARFILE) -C jni/java-build org

java: native $(JARFILE)

JNI_INC = -I$(JAVA_HOME)/include/linux -I$(JAVA_HOME)/include

clean:
	rm -f $(shell find jni -iregex .\*\\.o\$)
	rm -f $(LIBRARY) $(JARFILE)
	rm -rf jni/java-build

realclean: clean
	rm -rf jni/src jni/JAVA-SOURCES.LST INCLUDES.LST wrap.log
	rm -rf include/Inventor