Makefile (2622B)
1 DIR_Config = ./lib/Config 2 DIR_EPD = ./lib/e-Paper 3 DIR_FONTS = ./lib/Fonts 4 DIR_GUI = ./lib/GUI 5 DIR_Examples = ./examples 6 DIR_BIN = ./bin 7 8 OBJ_C = $(wildcard ${DIR_EPD}/*.c ${DIR_GUI}/*.c ${DIR_Examples}/*.c ${DIR_FONTS}/*.c ) 9 OBJ_O = $(patsubst %.c,${DIR_BIN}/%.o,$(notdir ${OBJ_C})) 10 RPI_DEV_C = $(wildcard $(DIR_BIN)/dev_hardware_SPI.o $(DIR_BIN)/RPI_sysfs_gpio.o $(DIR_BIN)/DEV_Config.o ) 11 JETSON_DEV_C = $(wildcard $(DIR_BIN)/sysfs_software_spi.o $(DIR_BIN)/sysfs_gpio.o $(DIR_BIN)/DEV_Config.o ) 12 13 14 DEBUG = -D DEBUG 15 16 # USELIB_RPI = USE_BCM2835_LIB 17 USELIB_RPI = USE_WIRINGPI_LIB 18 # USELIB_RPI = USE_DEV_LIB 19 20 ifeq ($(USELIB_RPI), USE_BCM2835_LIB) 21 LIB_RPI = -lbcm2835 -lm 22 else ifeq ($(USELIB_RPI), USE_WIRINGPI_LIB) 23 LIB_RPI = -lwiringPi -lm 24 else ifeq ($(USELIB_RPI), USE_DEV_LIB) 25 LIB_RPI = -lm 26 endif 27 DEBUG_RPI = -D $(USELIB_RPI) -D RPI 28 29 USELIB_JETSONI = USE_DEV_LIB 30 # USELIB_JETSONI = USE_HARDWARE_LIB 31 ifeq ($(USELIB_JETSONI), USE_DEV_LIB) 32 LIB_JETSONI = -lm 33 else ifeq ($(USELIB_JETSONI), USE_HARDWARE_LIB) 34 LIB_JETSONI = -lm 35 endif 36 DEBUG_JETSONI = -D $(USELIB_JETSONI) -D JETSON 37 38 .PHONY : RPI JETSON clean 39 40 RPI:RPI_DEV RPI_epd 41 JETSON: JETSON_DEV JETSON_epd 42 43 TARGET = epd 44 CC = gcc 45 MSG = -g -O0 -Wall -std=gnu11 46 CFLAGS += $(MSG) 47 48 RPI_epd:${OBJ_O} 49 echo $(@) 50 $(CC) $(CFLAGS) -D RPI $(OBJ_O) $(RPI_DEV_C) -o $(TARGET) $(LIB_RPI) $(DEBUG) 51 52 JETSON_epd:${OBJ_O} 53 echo $(@) 54 $(CC) $(CFLAGS) $(OBJ_O) $(JETSON_DEV_C) -o $(TARGET) $(LIB_JETSONI) $(DEBUG) 55 56 ${DIR_BIN}/%.o:$(DIR_Examples)/%.c 57 $(CC) $(CFLAGS) -c $< -o $@ -I $(DIR_Config) -I $(DIR_GUI) -I $(DIR_EPD) $(DEBUG) 58 59 ${DIR_BIN}/%.o:$(DIR_EPD)/%.c 60 $(CC) $(CFLAGS) -c $< -o $@ -I $(DIR_Config) $(DEBUG) 61 62 ${DIR_BIN}/%.o:$(DIR_FONTS)/%.c 63 $(CC) $(CFLAGS) -c $< -o $@ $(DEBUG) 64 65 ${DIR_BIN}/%.o:$(DIR_GUI)/%.c 66 $(CC) $(CFLAGS) -c $< -o $@ -I $(DIR_Config) $(DEBUG) 67 68 RPI_DEV: 69 $(CC) $(CFLAGS) $(DEBUG_RPI) -c $(DIR_Config)/dev_hardware_SPI.c -o $(DIR_BIN)/dev_hardware_SPI.o $(LIB_RPI) $(DEBUG) 70 $(CC) $(CFLAGS) $(DEBUG_RPI) -c $(DIR_Config)/RPI_sysfs_gpio.c -o $(DIR_BIN)/RPI_sysfs_gpio.o $(LIB_RPI) $(DEBUG) 71 $(CC) $(CFLAGS) $(DEBUG_RPI) -c $(DIR_Config)/DEV_Config.c -o $(DIR_BIN)/DEV_Config.o $(LIB_RPI) $(DEBUG) 72 73 JETSON_DEV: 74 $(CC) $(CFLAGS) $(DEBUG_JETSONI) -c $(DIR_Config)/sysfs_software_spi.c -o $(DIR_BIN)/sysfs_software_spi.o $(LIB_JETSONI) $(DEBUG) 75 $(CC) $(CFLAGS) $(DEBUG_JETSONI) -c $(DIR_Config)/sysfs_gpio.c -o $(DIR_BIN)/sysfs_gpio.o $(LIB_JETSONI) $(DEBUG) 76 $(CC) $(CFLAGS) $(DEBUG_JETSONI) -c $(DIR_Config)/DEV_Config.c -o $(DIR_BIN)/DEV_Config.o $(LIB_JETSONI) $(DEBUG) 77 78 clean : 79 rm $(DIR_BIN)/*.* 80 rm $(TARGET) 81