-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
56 lines (37 loc) · 1.23 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
DIR_Config = ./lib/Config
DIR_EPD = ./lib/e-Paper
DIR_FONTS = ./lib/Fonts
DIR_GUI = ./lib/GUI
DIR_Source = ./source
DIR_BIN = ./bin
OBJ_C = $(wildcard ${DIR_Config}/*.c ${DIR_EPD}/*.c ${DIR_FONTS}/*.c ${DIR_GUI}/*.c ${DIR_Source}/*.c)
OBJ_O = $(patsubst %.c,${DIR_BIN}/%.o,$(notdir ${OBJ_C}))
TARGET = epframe
CC = gcc
MSG = -g -O0 -Wall
DEBUG = -D USE_DEBUG
STD = -std=gnu99
CFLAGS += $(MSG) $(DEBUG) $(STD)
LIB_USE = -lm -lrt -lpthread
LIB = BCM
LIB_USE += -lbcm2835
OBJ_O := $(filter-out ${DIR_BIN}/RPI_gpiod.o ${DIR_BIN}/dev_hardware_SPI.o, ${OBJ_O})
$(shell mkdir -p $(DIR_BIN))
${TARGET}: ${OBJ_O}
$(CC) $(CFLAGS) $^ -o $@ $(LIB_USE)
${DIR_BIN}/%.o: ${DIR_Config}/%.c
$(CC) $(CFLAGS) -D $(LIB) -c $< -o $@
${DIR_BIN}/%.o: ${DIR_EPD}/%.c
$(CC) $(CFLAGS) -c $< -o $@
${DIR_BIN}/%.o: ${DIR_FONTS}/%.c
$(CC) $(CFLAGS) -c $< -o $@
${DIR_BIN}/%.o: ${DIR_GUI}/%.c
$(CC) $(CFLAGS) -c $< -o $@
${DIR_BIN}/%.o: ${DIR_Source}/%.c
$(CC) $(CFLAGS) -c $< -o $@
${DIR_BIN}/%.d: ${DIR_Config}/%.c
@set -e; rm -f $@; \
$(CC) -MM $(CFLAGS) $< | sed 's,^,$(DIR_BIN)/,' > $@
-include $(patsubst %.c,${DIR_BIN}/%.d,$(notdir ${OBJ_C}))
clean:
rm -rf $(DIR_BIN)/* $(TARGET)