forked from runezor/PiArtFrame
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
98 lines (75 loc) · 3.32 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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
DIR_Config = ./lib/waveshare/Config
DIR_EPD = ./lib/waveshare/e-Paper
DIR_FONTS = ./lib/waveshare/Fonts
DIR_GUI = ./lib/waveshare/GUI
DIR_Examples = ./lib/waveshare/Examples
DIR_Main = ./
DIR_BIN = ./bin
EPD = epd7in5V2
OBJ_C_EPD = ${DIR_EPD}/EPD_7in5_V2.c
OBJ_C_Examples = ${DIR_Examples}/EPD_7in5_V2_test.c
OBJ_C = $(wildcard ${OBJ_C_EPD} ${DIR_GUI}/*.c ${OBJ_C_Examples} ${DIR_Examples}/ImageData2.c ${DIR_Examples}/ImageData.c ${DIR_FONTS}/*.c ${DIR_Main}/*.cpp ${DIR_Main}/*.c)
OBJ_O = $(patsubst %.c,${DIR_BIN}/%.o,$(notdir ${OBJ_C}))
RPI_DEV_C = $(wildcard $(DIR_BIN)/dev_hardware_SPI.o $(DIR_BIN)/RPI_gpiod.o $(DIR_BIN)/DEV_Config.o )
JETSON_DEV_C = $(wildcard $(DIR_BIN)/sysfs_software_spi.o $(DIR_BIN)/sysfs_gpio.o $(DIR_BIN)/DEV_Config.o )
DEBUG = -D DEBUG
# USELIB_RPI = USE_BCM2835_LIB
# USELIB_RPI = USE_WIRINGPI_LIB
USELIB_RPI = USE_LGPIO_LIB
# USELIB_RPI = USE_DEV_LIB
LIB_RPI=-Wl,--gc-sections
ifeq ($(USELIB_RPI), USE_BCM2835_LIB)
LIB_RPI += -lbcm2835 -lm
else ifeq ($(USELIB_RPI), USE_WIRINGPI_LIB)
LIB_RPI += -lwiringPi -lm
else ifeq ($(USELIB_RPI), USE_LGPIO_LIB)
LIB_RPI += -llgpio -lm
else ifeq ($(USELIB_RPI), USE_DEV_LIB)
LIB_RPI += -lgpiod -lm
endif
DEBUG_RPI = -D $(USELIB_RPI) -D RPI
USELIB_JETSONI = USE_DEV_LIB
# USELIB_JETSONI = USE_HARDWARE_LIB
ifeq ($(USELIB_JETSONI), USE_DEV_LIB)
LIB_JETSONI = -lm
else ifeq ($(USELIB_JETSONI), USE_HARDWARE_LIB)
LIB_JETSONI = -lm
endif
DEBUG_JETSONI = -D $(USELIB_JETSONI) -D JETSON
.PHONY : RPI JETSON clean
RPI:RPI_DEV RPI_epd
JETSON: JETSON_DEV JETSON_epd
TARGET = piArtFrame
CC = g++
MSG = -g -O -ffunction-sections -fdata-sections -Wall
CFLAGS += $(MSG) -D $(EPD)
RPI_epd:${OBJ_O}
echo $(@)
$(CC) $(CFLAGS) -D RPI $(OBJ_O) $(RPI_DEV_C) -I $(DIR_Config) -I $(DIR_GUI) -I $(DIR_EPD) -o $(TARGET) $(LIB_RPI) $(DEBUG)
JETSON_epd:${OBJ_O}
echo $(@)
$(CC) $(CFLAGS) $(OBJ_O) $(JETSON_DEV_C) -o $(TARGET) $(LIB_JETSONI) $(DEBUG)
$(shell mkdir -p $(DIR_BIN))
${DIR_BIN}/%.o:$(DIR_Examples)/%.c
$(CC) $(CFLAGS) -c $< -o $@ -I $(DIR_Config) -I $(DIR_GUI) -I $(DIR_EPD) $(DEBUG)
${DIR_BIN}/%.o:$(DIR_EPD)/%.c
$(CC) $(CFLAGS) -c $< -o $@ -I $(DIR_Config) $(DEBUG)
${DIR_BIN}/%.o:$(DIR_FONTS)/%.c
$(CC) $(CFLAGS) -c $< -o $@ $(DEBUG)
${DIR_BIN}/%.o:$(DIR_GUI)/%.c
$(CC) $(CFLAGS) -c $< -o $@ -I $(DIR_Config) $(DEBUG)
${DIR_BIN}/%.o:$(DIR_Main)/%.c
$(CC) $(CFLAGS) -c $< -o $@ -I $(DIR_Examples) -I $(DIR_Config) -I $(DIR_GUI) -I $(DIR_Main) -I $(DIR_EPD) $(DEBUG)
${DIR_BIN}/%.o:$(DIR_Main)/%.cpp
$(CC) $(CFLAGS) -c $< -o $@ -I $(DIR_Examples) -I $(DIR_Config) -I $(DIR_GUI) -I $(DIR_Main) -I $(DIR_EPD) $(DEBUG)
RPI_DEV:
$(CC) $(CFLAGS) $(DEBUG_RPI) -c $(DIR_Config)/dev_hardware_SPI.c -o $(DIR_BIN)/dev_hardware_SPI.o $(LIB_RPI) $(DEBUG)
$(CC) $(CFLAGS) $(DEBUG_RPI) -c $(DIR_Config)/RPI_gpiod.c -o $(DIR_BIN)/RPI_gpiod.o $(LIB_RPI) $(DEBUG)
$(CC) $(CFLAGS) $(DEBUG_RPI) -c $(DIR_Config)/DEV_Config.c -o $(DIR_BIN)/DEV_Config.o $(LIB_RPI) $(DEBUG)
JETSON_DEV:
$(CC) $(CFLAGS) $(DEBUG_JETSONI) -c $(DIR_Config)/sysfs_software_spi.c -o $(DIR_BIN)/sysfs_software_spi.o $(LIB_JETSONI) $(DEBUG)
$(CC) $(CFLAGS) $(DEBUG_JETSONI) -c $(DIR_Config)/sysfs_gpio.c -o $(DIR_BIN)/sysfs_gpio.o $(LIB_JETSONI) $(DEBUG)
$(CC) $(CFLAGS) $(DEBUG_JETSONI) -c $(DIR_Config)/DEV_Config.c -o $(DIR_BIN)/DEV_Config.o $(LIB_JETSONI) $(DEBUG)
clean :
rm $(DIR_BIN)/*.*
rm $(TARGET)