easymini: Elide symbols from combined .ihx file
[fw/altos] / libaltos / Makefile.am
1 export PATH=$(shell echo "$$PWD:$$PATH")
2 AM_CFLAGS=-DLINUX -DPOSIX_TTY -I$(JVM_INCLUDE) -I$(JVM_INCLUDE)/linux
3 AM_JAVACFLAGS=$(JAVAC_VERSION_FLAGS) -encoding UTF-8 -Xlint:deprecation -Xlint:unchecked
4
5 altoslibdir=$(libdir)/altos
6
7 altoslib_LTLIBRARIES=libaltos.la
8 libaltos_la_LDFLAGS=-version-info 1:0:1 -Wl,-znoexecstack
9
10 libaltos_la_SOURCES=\
11         libaltos_common.c \
12         libaltos_posix.c \
13         libaltos_linux.c \
14         libaltos_wrap.c \
15         libaltos.h \
16         libaltos_posix.h \
17         libaltos_private.h
18
19 WINDOWS_SRC=\
20         libaltos_common.c\
21         libaltos_windows.c\
22         libaltos_wrap.c
23
24 WINDOWS_H=\
25         libaltos.h
26
27 noinst_PROGRAMS=cjnitest btletest
28
29 cjnitest_SOURCES=cjnitest.c
30 cjnitest_LDADD=libaltos.la
31
32 btletest_SOURCES=btletest.c
33
34 btletest_LDADD=-lbluetooth
35
36 if MULTI_ARCH
37 altoslib_LTLIBRARIES+=libaltos_i686.la libaltos_amd64.la libaltos_aarch64.la libaltos_armel.la libaltos_armhf.la
38
39 I686=i686-linux-gnu
40 libaltos_i686_la_LDFLAGS=-Wl,arch=$(I686) $(libaltos_la_LDFLAGS)
41 libaltos_i686_la_CFLAGS=-Warch=i686-linux-gnu $(AM_CFLAGS)
42 libaltos_i686_la_SOURCES=$(libaltos_la_SOURCES)
43
44 AMD64=x86_64-linux-gnu
45 libaltos_amd64_la_LDFLAGS=-Wl,arch=$(AMD64) $(libaltos_la_LDFLAGS)
46 libaltos_amd64_la_CFLAGS=-Warch=x86_64-linux-gnu $(AM_CFLAGS)
47 libaltos_amd64_la_SOURCES=$(libaltos_la_SOURCES)
48
49 AARCH64=aarch64-linux-gnu
50 libaltos_aarch64_la_LDFLAGS=-Wl,arch=$(AARCH64) $(libaltos_la_LDFLAGS)
51 libaltos_aarch64_la_CFLAGS=-Warch=$(AARCH64) $(AM_CFLAGS)
52 libaltos_aarch64_la_SOURCES=$(libaltos_la_SOURCES)
53
54 ARMEL=arm-linux-gnueabi
55 libaltos_armel_la_LDFLAGS=-Wl,arch=$(ARMEL) $(libaltos_la_LDFLAGS)
56 libaltos_armel_la_CFLAGS=-Warch=$(ARMEL) $(AM_CFLAGS)
57 libaltos_armel_la_SOURCES=$(libaltos_la_SOURCES)
58
59 ARMHF=arm-linux-gnueabihf
60 libaltos_armhf_la_LDFLAGS=-Wl,arch=$(ARMHF) $(libaltos_la_LDFLAGS)
61 libaltos_armhf_la_CFLAGS=-Warch=$(ARMHF) $(AM_CFLAGS)
62 libaltos_armhf_la_SOURCES=$(libaltos_la_SOURCES)
63
64 noinst_PROGRAMS+=cjnitest_i686 cjnitest_amd64 cjnitest_aarch64 cjnitest_armel cjnitest_armhf
65
66 cjnitest_i686_CFLAGS=$(libaltos_i686_la_CFLAGS)
67 cjnitest_i686_LDFLAGS=-Wl,arch=$(I686)
68 cjnitest_i686_SOURCES=$(cjnitest_SOURCES)
69 cjnitest_i686_LDADD=libaltos_i686.la
70
71 cjnitest_amd64_CFLAGS=$(libaltos_amd64_la_CFLAGS)
72 cjnitest_amd64_LDFLAGS=-Wl,arch=$(AMD64)
73 cjnitest_amd64_SOURCES=$(cjnitest_SOURCES)
74 cjnitest_amd64_LDADD=libaltos_amd64.la
75
76 cjnitest_aarch64_CFLAGS=$(libaltos_aarch64_la_CFLAGS)
77 cjnitest_aarch64_LDFLAGS=-Wl,arch=$(AARCH64)
78 cjnitest_aarch64_SOURCES=$(cjnitest_SOURCES)
79 cjnitest_aarch64_LDADD=libaltos_aarch64.la
80
81 cjnitest_armel_CFLAGS=$(libaltos_armel_la_CFLAGS)
82 cjnitest_armel_LDFLAGS=-Wl,arch=$(ARMEL)
83 cjnitest_armel_SOURCES=$(cjnitest_SOURCES)
84 cjnitest_armel_LDADD=libaltos_armel.la
85
86 cjnitest_armhf_CFLAGS=$(libaltos_armhf_la_CFLAGS)
87 cjnitest_armhf_LDFLAGS=-Wl,arch=$(ARMHF)
88 cjnitest_armhf_SOURCES=$(cjnitest_SOURCES)
89 cjnitest_armhf_LDADD=libaltos_armhf.la
90
91 endif
92
93 LIBS=-ldl
94
95 HFILES=libaltos.h
96
97 SWIG_FILE=libaltos.swig
98
99 CLASSDIR=libaltosJNI
100
101 $(SWIG_FILE): libaltos.i0 $(HFILES)
102         sed 's;//%;%;' libaltos.i0 $(HFILES) > $(SWIG_FILE)
103
104 all-local: classlibaltos.stamp
105
106 test:
107         which gcc
108
109 libaltos_wrap.c: classlibaltos.stamp
110
111 classlibaltos.stamp: $(SWIG_FILE)
112         swig -java -package libaltosJNI $(SWIG_FILE)
113         mkdir -p libaltosJNI
114         $(JAVAC) -d . $(AM_JAVACFLAGS) $(JAVACFLAGS) *.java && \
115         touch classlibaltos.stamp
116
117 MINGCC32=i686-w64-mingw32-gcc
118 MINGCC64=x86_64-w64-mingw32-gcc
119 MINGFLAGS=-Wall -Wextra -DWINDOWS -DBUILD_DLL -mconsole -I$(JVM_INCLUDE) -I$(JVM_INCLUDE)/linux
120 MINGLIBS=-lsetupapi -lws2_32
121
122 fat: all altos.dll altos64.dll
123
124 altos.dll: $(WINDOWS_SRC) $(WINDOWS_H)
125         SOURCE_DATE_EPOCH=0 $(MINGCC32) -o $@ $(MINGFLAGS) -shared $(WINDOWS_SRC) $(MINGLIBS)
126
127 altos64.dll: $(WINDOWS_SRC) $(WINDOWS_H)
128         SOURCE_DATE_EPOCH=0 $(MINGCC64) -o $@ $(MINGFLAGS) -shared $(WINDOWS_SRC) $(MINGLIBS)
129
130 clean-local:
131         -rm -rf libaltosJNI *.class *.java classlibaltos.stamp $(SWIG_FILE) libaltos_wrap.c altos.dll altos64.dll