summaryrefslogtreecommitdiff
path: root/Makefile
blob: 8b0913e4b503271395f96806a442bda17c98b9fd (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

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

LIBS := -lmts-io -lmts -ljsoncpp -lrt -lpthread

OBJS += \
Version.o \
main.o

CPP_DEPS += \
Version.d \
main.d

all: postbuild

prebuild:
	@echo PRE-BUILD
	@echo 'Removing previous version components started'
	-$(RM) Version.o
	-$(RM) Version.d
	-$(RM) Version.cpp
	@echo 'Removing previous version components complete'
	@echo ' '
	
postbuild: mainbuild
	@echo POST-BUILD
	@echo ' '

mainbuild: prebuild
	@echo MAIN-BUILD
	@$(MAKE) --no-print-directory target

target: $(OBJS)
	@echo 'Building target: $@'
	$(CXX) $(CFLAGS) $(LDFLAGS) -o radio-cmd $(OBJS) $(LIBS)
	@echo 'Finished building target: $@'
	@echo ' '

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

Version.cpp:
	@echo 'Creating file: Version.cpp'
	/bin/echo -e "//Pre-Build Auto-Generated Source\n#include \"Version.h\"\n\nconst std::string Version::version(\"$(shell git describe)\");" > Version.cpp
	@echo 'Finished creating: Version.cpp'
	@echo ' '

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

install:
	install -d $(DESTDIR)/usr/bin
	install -m 0755 radio-cmd $(DESTDIR)/usr/bin

strip:
	$(STRIP) radio-cmd

clean:
	-$(RM) $(OBJS) $(CPP_DEPS) radio-cmd
	-@echo ' '

.PHONY: all clean dependents install strip target
.SECONDARY: