-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
73 lines (58 loc) · 1.82 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
CC=g++
# pass BUILD_FOR as string to $(CC)
DEFINES= -D$(IF) -D$(PLATFORM)
INCLUDES= .
CFLAGS= -I$(INCLUDES) $(DEFINES) -Wall
LIBS=
DEPS= hcl.h hcl_gpio.h sensor_epsonCommon.h main_helper.h
DEPS_UART= hcl_uart.h sensor_epsonUart.h
DEPS_SPI= hcl_spi.h sensor_epsonSpi.h
OBJ= main_helper.o sensor_epsonCommon.o
# defaults Interface to UART
IF ?= UART
# defaults to NONE
PLATFORM ?= NONE
####### Adding IF Specific Files
ifeq ($(IF), UART)
OBJ+= sensor_epsonUart.o hcl_uart.o
DEPS+= $(DEPS_UART)
else ifeq ($(IF), SPI)
OBJ+= sensor_epsonSpi.o hcl_spi_rpi.o
DEPS+= $(DEPS_SPI)
PLATFORM= RPI
endif
####### Adding PLATFORM Specific Files
ifeq ($(PLATFORM), NONE)
OBJ+= hcl_linux.o hcl_gpio.o
else ifeq ($(PLATFORM), RPI)
OBJ+= hcl_rpi.o hcl_gpio_rpi.o
LIBS+= -lwiringPi -lpthread -lcrypt -lrt
endif
all: screen csvlogger regdump
%.o: %.c $(DEPS)
$(CC) -c -o $@ $< $(CFLAGS) $(LIBS)
screen: $(OBJ) main_screen.o
$(CC) -o $@ $^ $(CFLAGS) $(LIBS)
csvlogger: $(OBJ) main_csvlogger.o
$(CC) -o $@ $^ $(CFLAGS) $(LIBS)
regdump: $(OBJ) main_regdump.o
$(CC) -o $@ $^ $(CFLAGS) $(LIBS)
.PHONY: clean all tar help
clean:
rm -f $(OBJ) *~ core *~ *.o
rm -f csvlogger screen regdump
tar:
tar cvzf archive.tar.gz *.c *.h README.md Makefile
help:
@echo "supported make commands are:"
@echo "\tmake clean"
@echo "\tmake <targets>\n"
@echo "valid <targets> are: all csvlogger screen or regdump\n"
@echo "valid <interfaces, IF> are:"
@echo "\tUART SPI"
@echo "valid <platforms, PLATFORM> are:"
@echo "\tNONE RPI"
@echo "example:\n\tmake csvlogger (defaults PLATFORM=NONE, IF=UART)"
@echo "\tmake screen PLATFORM=RPI (defaults to IF=UART)"
@echo "\tmake regdump IF=SPI PLATFORM=RPI"
@echo "\tmake all (defaults to PLATFORM=NONE, IF=UART, targets=csvlogger, screen, regdump)"