-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
executable file
·69 lines (50 loc) · 2.04 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
DIR_Config = ./lib/Config
DIR_EPD = ./lib/LCD
DIR_FONTS = ./lib/Fonts
DIR_GUI = ./lib/GUI
DIR_Examples = ./examples
DIR_Examples_img = ./examples/img
DIR_Examples_util = ./examples/util
DIR_Examples_http = ./examples/http
DIR_CJSON = ./lib/cjson
DIR_BIN = ./bin
CC = riscv64-linux-gnu-gcc
MSG = -g -O0 -Wall
CFLAGS += $(MSG) $(DEBUG)
OBJ_C = $(wildcard ${DIR_EPD}/*.c ${DIR_Config}/*.c ${DIR_GUI}/*.c ${DIR_Examples}/*.c ${DIR_FONTS}/*.c ${DIR_CJSON}/*.c ${DIR_Examples_img}/*.c ${DIR_Examples_util}/*.c ${DIR_Examples_http}/*.c)
OBJ_O = $(patsubst %.c,${DIR_BIN}/%.o,$(notdir ${OBJ_C}))
TARGET = main
#USELIB = USE_BCM2835_LIB
#USELIB = USE_WIRINGPI_LIB
USELIB = USE_DEV_LIB
DEBUG = -D $(USELIB)
ifeq ($(USELIB), USE_BCM2835_LIB)
LIB = -lbcm2835 -lm
else ifeq ($(USELIB), USE_WIRINGPI_LIB)
LIB = -lwiringPi -lm
else ifeq ($(USELIB), USE_DEV_LIB)
LIB = -lpthread -lm
endif
${TARGET}:${OBJ_O}
$(CC) $(CFLAGS) $(OBJ_O) -o $@ $(LIB)
${DIR_BIN}/%.o:$(DIR_Examples)/%.c
$(CC) $(CFLAGS) -c $< -o $@ -I $(DIR_Config) -I $(DIR_GUI) -I $(DIR_EPD) -I $(DIR_FONTS) -I $(DIR_CJSON) -I $(DIR_Examples_img) -I $(DIR_Examples_util) -I $(DIR_Examples_http)
${DIR_BIN}/%.o:$(DIR_EPD)/%.c
$(CC) $(CFLAGS) -c $< -o $@ -I $(DIR_Config)
${DIR_BIN}/%.o:$(DIR_FONTS)/%.c
$(CC) $(CFLAGS) -c $< -o $@
${DIR_BIN}/%.o:$(DIR_GUI)/%.c
$(CC) $(CFLAGS) -c $< -o $@ -I $(DIR_Config) -I $(DIR_EPD) -I $(DIR_Examples)
${DIR_BIN}/%.o:$(DIR_Config)/%.c
$(CC) $(CFLAGS) -c $< -o $@ $(LIB)
${DIR_BIN}/%.o:$(DIR_CJSON)/%.c
$(CC) $(CFLAGS) -c $< -o $@ -I $(DIR_CJSON)
${DIR_BIN}/%.o:$(DIR_Examples_img)/%.c
$(CC) $(CFLAGS) -c $< -o $@ -I $(DIR_Examples_img)
${DIR_BIN}/%.o:$(DIR_Examples_util)/%.c
$(CC) $(CFLAGS) -c $< -o $@ -I $(DIR_Config) -I $(DIR_GUI) -I $(DIR_EPD) -I $(DIR_FONTS) -I $(DIR_CJSON) -I $(DIR_Examples_img) -I $(DIR_Examples_util)
${DIR_BIN}/%.o:$(DIR_Examples_http)/%.c
$(CC) $(CFLAGS) -c $< -o $@ -I $(DIR_Examples_http)
clean :
rm $(DIR_BIN)/*.*
rm $(TARGET)