summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile66
1 files changed, 66 insertions, 0 deletions
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..d1e6a87
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,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:
+