summaryrefslogtreecommitdiff
path: root/Makefile
blob: d1e6a87dd612c02cec60ca269e1886d76690ab9b (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
include version

includedir ?= /usr/include
libdir ?= /usr/lib

OBJS += \
MTS_Buffer.o \
MTS_Condition.o \
MTS_Lock.o \
MTS_Logger.o \
MTS_Object.o \
MTS_SignalThread.o \
MTS_System.o \
MTS_Text.o \
MTS_Thread.o \
MTS_Timer.o \
MTS_TimerThread.o

CPP_DEPPS+= \
MTS_Buffer.d \
MTS_Condition.d \
MTS_Lock.d \
MTS_Logger.d \
MTS_Object.d \
MTS_SignalThread.d \
MTS_System.d \
MTS_Text.d \
MTS_Thread.d \
MTS_Timer.d \
MTS_TimerThread.d

all: libmts.a libmts.so.0

libmts.a: $(OBJS)
	@echo 'Building target: $@'
	$(AR) -r  libmts.a $(OBJS)
	@echo 'Finished building target: $@'
	@echo ' '

libmts.so.0: $(OBJS)
	@echo 'Building target: $@'
	$(CXX) -shared -Wl,-soname,$@ -o libmts.so.$(VERSION) $(OBJS)
	@echo 'Finished building target: $@'
	@echo ' '

%.o: src/%.cpp
	@echo 'Building file: $<'
	$(CXX) $(CFLAGS) -Iinclude -Wall -Werror -c -fPIC -fmessage-length=0 -std=c++0x -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -o "$@" "$<"
	@echo 'Finished building: $<'
	@echo ' '

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

clean:
	-$(RM) $(OBJS) $(CPP_DEPPS) libmts.a libmts.so*
	-@echo ' '

.PHONY: all clean dependents install
.SECONDARY: