-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
executable file
·62 lines (45 loc) · 1.48 KB
/
Makefile
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
CC = g++
# CC = gcc
CFLAGGS = -g -pthread -lstdc++ -ljsoncpp -lcurl -rdynamic
CFLAGGS_OPTIMIZED = -pthread -lstdc++ -ljsoncpp -lcurl -rdynamic
#€-lwiringPi
#-Werror
BUILD_PATH= build/
SOURCE_PATH= src src/* src/*/* src/*/* tinyosc
TARGET = main
OUTNAME = rainpots
# TARGET = serial-test
# TARGET = json_test
# TARGET = stacktraceteest
# OUTNAME = $(TARGET)
SRCS = $(wildcard $(foreach fd, $(SOURCE_PATH), $(fd)/*.c))
SRCS_CPP = $(wildcard $(foreach fd, $(SOURCE_PATH), $(fd)/*.cpp))
# $(NULL) is empty string
NULL :=
# $(SPACE) is one space
SPACE := $(NULL) $(NULL)
# $(\n) is new line
ENDLN = "\n"
SRCS_FORMATTED = $(subst $(SPACE),$(ENDLN),$(SRCS))
SRCS_CPP_FORMATTED = $(subst $(SPACE),$(ENDLN),$(SRCS_CPP))
.PHONY: clean
# $@ = target name
# $^ = dependency list
all: clean $(TARGET)
clean:
rm -rf $(BUILD_PATH)*.o
rm -rf $(BUILD_PATH)$(TARGET)
rm -rf $(BUILD_PATH)$(OUTNAME)
$(TARGET): $(SRCS) $(SRCS_CPP)
@echo "\n***************************\n"
@echo $(SRCS_FORMATTED)
@echo $(SRCS_CPP_FORMATTED)
@echo "\n***************************\n"
# $(CC) $^ $(TARGET).cpp $(CFLAGGS) -o $(BUILD_PATH)$@
# $(CC) $^ $(TARGET).cpp $(CFLAGGS) -o $(BUILD_PATH)$(OUTNAME)
$(CC) $^ $(TARGET).cpp $(CFLAGGS_OPTIMIZED) -o $(BUILD_PATH)$(OUTNAME)
@echo "\n"
install:
@if [ ! -d "/home/pi/Documents/rainpots" ]; then mkdir /home/pi/Documents/rainpots; fi
@if [ ! -d "/home/pi/Documents/rainpots/log" ];then mkdir /home/pi/Documents/rainpots/log; fi
sudo cp ./$(BUILD_PATH)rainpots /usr/bin