-
Notifications
You must be signed in to change notification settings - Fork 3
/
Makefile
executable file
·108 lines (84 loc) · 3.29 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
98
99
100
101
102
103
104
105
106
107
108
# define the C compiler to use
CC = gcc
LIBS := -lpthread -lm
#LIBS := -lpthread -lwebsockets
#LIBS := -lm
# debug of not
#DBG = -g -O0 -fsanitize=address -static-libasan
DBG = -g
#DBG = -D TESTING
#DBG =
# define any compile-time flags
#CFLAGS = -Wall -g -lpthread -lwiringPi -lm -I.
#CFLAGS = -Wall -g $(LIBS) -I/usr/local/include/ -L/usr/local/lib/
#CFLAGS = -Wall -g $(LIBS) -std=gnu11 -I/nas/data/Development/Raspberry/aqualink/libwebsockets-2.0-stable/lib -L/nas/data/Development/Raspberry/aqualink/libwebsockets-2.0-stable/lib
#CFLAGS = -Wall -g $(LIBS)
#CFLAGS = -Wall -g $(LIBS) -std=gnu11
CFLAGS = -Wall $(DBG) $(LIBS) -D MG_DISABLE_MD5 -D MG_DISABLE_HTTP_DIGEST_AUTH -D MG_DISABLE_MD5 -D MG_DISABLE_JSON_RPC
#CFLAGS = -Wall $(DBG) $(LIBS) -D MG_DISABLE_MQTT -D MG_DISABLE_MD5 -D MG_DISABLE_HTTP_DIGEST_AUTH -D MG_DISABLE_MD5 -D MG_DISABLE_JSON_RPC
#INCLUDES = -I/nas/data/Development/Raspberry/aqualink/aqualinkd
#INCLUDES = -I./ -I../ -I./aquapure/
INCLUDES = -I./ -I./GPIO_Pi -I./minIni
# Add inputs and outputs from these tool invocations to the build variables
# define the C source files
#SRCS = aqualinkd.c utils.c config.c aq_serial.c init_buttons.c aq_programmer.c net_services.c json_messages.c mongoose.c
.SUFFIXES: .o_test
#SL_SRC = serial_logger.c aq_serial.c utils.c
#AL_SRC = aquapure_logger.c aq_serial.c utils.c
SRCS = aquapure.c ap_net_services.c SWG_device.c aq_serial.c utils.c mongoose.c json_messages.c config.c \
packetLogger.c GPIO_device.c ./GPIO_Pi/GPIO_Pi.c ./minIni/minIni.c
#SRCS = aq_serial.c utils.c mongoose.c json_messages.c config.c aquapured/ap_net_services.c aquapured/ap_config.c aquapured/aquapure.c
TEST_D_SRC = aquapure.c aq_serial.c
OBJS = $(SRCS:.c=.o)
TEST_SRC := $(filter-out $(TEST_D_SRC), $(SRCS))
TEST_OBJS = $(TEST_SRC:.c=.o)
TEST_D_OBJS = $(TEST_D_SRC:.c=.o_test)
#SL_OBJS = $(SL_SRC:.c=.o)
#AL_OBJS = $(AL_SRC:.c=.o)
#AP_OBJS = $(AP_SRC:.c=.o)
# define the executable file
MAIN = ./release/aquapured
TEST = ./release/aquapured_test
#SLOG = ./release/serial_logger
#AQUAPURELOG = ./release/aquapure_logger
#AQUAPURED = ./release/aquapured
all: $(MAIN)
@echo: $(MAIN) have been compiled
$(MAIN): $(OBJS)
$(CC) $(CFLAGS) $(INCLUDES) -o $(MAIN) $(OBJS) $(LFLAGS) $(LIBS)
test: $(TEST_OBJS) $(TEST_D_OBJS)
$(CC) $(CFLAGS) $(INCLUDES) -o $(TEST) $(TEST_OBJS) $(TEST_D_OBJS) $(LFLAGS) $(LIBS)
# this is a suffix replacement rule for building .o's from .c's
# it uses automatic variables $<: the name of the prerequisite of
# the rule(a .c file) and $@: the name of the target of the rule (a .o file)
# (see the gnu make manual section about automatic variables)
.c.o:
$(CC) $(CFLAGS) $(INCLUDES) -c $< -o $@
.c.o_test:
$(CC) $(CFLAGS) $(INCLUDES) -D TESTING -c $< -o $@
clean:
$(RM) *.o *~ *.o_test $(MAIN) $(MAIN_U) $(TEST)
depend: $(SRCS)
makedepend $(INCLUDES) $^
install: $(MAIN)
./release/install.sh
# All Target
#all: aqualinkd
#
# Tool invocations
#aqualinkd: $(OBJS) $(USER_OBJS)
# @echo 'Building target: $@'
# @echo 'Invoking: GCC C Linker'
# gcc -L/home/perry/workspace/libwebsockets/Debug -pg -o"aqualinkd" $(OBJS) $(USER_OBJS) $(LIBS)
# @echo 'Finished building target: $@'
# @echo ' '
#
# Other Targets
#clean:
# -$(RM) $(OBJS)$(C_DEPS)$(EXECUTABLES) aqualinkd
# -@echo ' '
#
#.PHONY: all clean dependents
#.SECONDARY:
#
#-include ../makefile.targets