summaryrefslogtreecommitdiff
path: root/Makefile
blob: 95b5e40730e2366a3f7a02eec8f82b66b3802e9a (plain)
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
include version

APPNAME = libmts-io
SONAME = $(APPNAME).so.$(VERSION)
libdir ?= /usr/lib

OBJS += \
	src/MTS_IO_TelitRadio.o \
	src/MTS_IO_EG25Radio.o \
	src/MTS_IO_EG95Radio.o \
	src/MTS_IO_QuectelRadio.o \
	src/MTS_IO_CdmaRadio.o \
	src/MTS_IO_CE910Radio.o \
	src/MTS_IO_CellularRadio.o \
	src/MTS_IO_ICellularRadio.o \
	src/MTS_IO_CellularRadioFactory.o \
	src/MTS_IO_Connection.o \
	src/MTS_IO_DE910Radio.o \
	src/MTS_IO_GE910Radio.o \
	src/MTS_IO_HE910Radio.o \
	src/MTS_IO_HE910DRadio.o \
	src/MTS_IO_HE910EUDRadio.o \
	src/MTS_IO_LE910JN1Radio.o \
	src/MTS_IO_LE866Radio.o \
	src/MTS_IO_LE866A1JSRadio.o \
	src/MTS_IO_LE910Radio.o \
	src/MTS_IO_LE910NAGRadio.o \
	src/MTS_IO_LE910C4NFRadio.o \
	src/MTS_IO_LE910NA1Radio.o \
	src/MTS_IO_LE910SVGRadio.o \
	src/MTS_IO_LE910SV1Radio.o \
	src/MTS_IO_LE910EUGRadio.o \
	src/MTS_IO_LE910C4EURadio.o \
	src/MTS_IO_LE910EU1Radio.o \
	src/MTS_IO_LE910C1NSRadio.o \
	src/MTS_IO_LE910C1APRadio.o \
	src/MTS_IO_ME910C1WWRadio.o \
	src/MTS_IO_ME910Radio.o \
	src/MTS_IO_LockFile.o \
	src/MTS_IO_MccMncTable.o \
	src/MTS_IO_SerialConnection.o

CC := $(CXX)
CXXFLAGS += -Wall -Werror -std=c++0x -fmessage-length=0 -fPIC -fvisibility=hidden -fvisibility-inlines-hidden
CPPFLAGS += -I=/usr/include/jsoncpp -Iinclude
LDFLAGS += -s -shared -Wl,-soname,$(APPNAME).so.0

.PHONY: all clean install

all: $(APPNAME).a $(SONAME)

$(APPNAME).a: $(OBJS)
	$(AR) -rs $@ $?

$(SONAME): $(OBJS)
	$(CC) $(LDFLAGS) -o $@ $+ $(LDLIBS)

# Handle header dependencies
DEPS = $(OBJS:.o=.d)
CPPFLAGS += -MMD
-include $(DEPS)

install:
	mkdir -p $(DESTDIR)$(libdir)
	mkdir -p $(DESTDIR)$(includedir)/mts
	install -m 0644 $(APPNAME).a $(SONAME) $(DESTDIR)$(libdir)/
	ln -sf $(SONAME) $(DESTDIR)$(libdir)/$(APPNAME).so.0
	ln -sf $(SONAME) $(DESTDIR)$(libdir)/$(APPNAME).so
	install -m 0644 include/mts/* $(DESTDIR)$(includedir)/mts/

clean:
	$(RM) $(OBJS) $(APPNAME).a $(SONAME) $(DEPS)