Debian Codegraph @

Makefile

raw ◀ ▶
1 Debian patch touch this file
1 #
2 #
3 # License: LGPL-3.0-only same as upstream
4 # Copyright: 2018 Geert Stappers <[email protected]>
5 #
6
7 JAVA_HOME = /usr/lib/jvm/default-java
8 JAVA_INCLUDE_PATH = $(JAVA_HOME)/include
9
10 CC = gcc
11
12 # Define listSerialsj variables
13 LSJ_NAME = listSerialsj
14 LSJ_MAJOR = 1
15 LSJ_MINOR = 4
16 LSJ_PATCH = 0
17 LSJ_RELEASE = 0
18 LSJ_LINKERNAME = lib$(LSJ_NAME).so
19 LSJ_SONAME = $(LSJ_LINKERNAME).$(LSJ_MAJOR)
20 LSJ_REALNAME = $(LSJ_SONAME).$(LSJ_MINOR).$(LSJ_RELEASE)
21 LSJ_SRCS = jnilib.c
22 LSJ_OBJS = $(LSJ_SRCS:.c=.o)
23 $(LSJ_REALNAME): CUSTOM_CFLAGS =-fPIC -I$(JAVA_INCLUDE_PATH)\
24 -I$(JAVA_INCLUDE_PATH)/linux
25 $(LSJ_REALNAME): CUSTOM_LDFLAGS = -shared -lserialport
26
27
28 all: listserialportsc $(LSJ_REALNAME)
29
30
31 listserialportsc: main.c
32 $(CC) -g -o $@ $< -l serialport
33
34 $(LSJ_REALNAME): $(LSJ_OBJS)
•35 $(CC) $^ $(LDFLAGS) $(CUSTOM_LDFLAGS) -Wl,-soname,$(LSJ_SONAME) -o $@
36 ln -sf $@ $(LSJ_SONAME)
37 ln -sf $(LSJ_SONAME) $(LSJ_LINKERNAME)
38
39 %.o: %.c
40 $(CC) $(CFLAGS) $(CPPFLAGS) $(CUSTOM_CFLAGS) -c -o $@ $<
41
42 version: Makefile
43 echo "VERSION=$(LSJ_MAJOR).$(LSJ_MINOR).$(LSJ_PATCH)" > $@
44 @cat $@
45 @echo Advice: compare it with https://github.com/arduino/listSerialPortsC/tags
46
47 install: all
48 install -d $(DESTDIR)/usr/bin
49 install -m 755 listserialportsc $(DESTDIR)/usr/bin
50
51 clean:
52 rm -f *.so* *.o
53 rm -f listserialportsc
54
55 # after script/update_upstream or script/create_orig_tar_xz
56 # but before another build
57 dist-clean: clean
58 rm -f version compile_linux.sh
59
60 dist:
61 make version
62 script/create_orig_tar_xz
63 ls ../listserialportsc_*.orig.tar.xz