-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
80 lines (62 loc) · 1.71 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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
# makefile for testing
TARGET = pixied
#DEBUG=1
REV="1.00"
APP="Pixie Daemon"
CSRC = main.c
CSRC += spipi.c
CSRC += gpiopi.c
CSRC += parseconfig.c
CSRC += ledTask.c
CSRC += timeTask.c
OBJDIR=bin/
INCDIR=inc/
INC = ./inc
INC += /usr/local/include/ws2811
INC += ../jsmn
VPATH = ./src
INCLUDES=${patsubst %,-I%,${INC}}
CFLAGS = -c
CFLAGS += -D'REV=${REV}' -D'APP=${APP}'
OBJ = $(notdir $(CSRC:.c=.o))
ifdef DEBUG
DEFS += -DDEBUG
endif
CC=gcc
RM=rm
CP=cp
CHMOD=chmod
LIB = -pthread -lm /usr/local/lib/libws2811.a
all: ${OBJDIR} ${OBJDIR}${TARGET}
${OBJDIR}:
@test -d ${OBJDIR} || mkdir ${OBJDIR}
@test -d ../jsmn || echo "Can't find jsmn directory needed for this project, see readme."
${OBJDIR}%.o : %.c
${CC} ${CFLAGS} ${DEFS} ${INCLUDES} $< -o ${@}
${OBJDIR}${TARGET}: $(addprefix ${OBJDIR},${OBJ})
${CC} $(filter %.o %.a, ${^}) ${LIB} -o ${@}
install:
${CP} -f ${OBJDIR}${TARGET} /usr/local/bin/
${CP} -f assets/pixied.service /etc/systemd/system
${CHMOD} 664 /etc/systemd/system/pixied.service
@test -f /usr/local/etc/LEDcolor.json || ${CP} -f assets/default.json /usr/local/etc/LEDcolor.json
uninstall:
${RM} -f /usr/local/bin/${TARGET}
${RM} -f /usr/local/etc/LEDcolor.json
@if [ -f /etc/systemd/system/pixied.service ]; then\
systemctl is-enabled pixied && systemctl disable pixied;\
systemctl is-active --quiet pixied && service pixied stop;\
${RM} -f /etc/systemd/system/pixied.service;\
fi
clean:
${RM} -rf ${OBJDIR} ${wildcard *~}
print-%:
@echo $* = $($*)
help:
${CC} --version
@make --version
@make --print-data-base --question | awk '/^[^.%][-A-Za-z0-9_]*:/ { print substr($$1,1,length($$1)-1) }'
# include dependencies
ifneq "${MAKECMDGOALS}" "clean"
-include ${wildcard ${OBJDIR}*.d}
endif