2019-07-14 14:39:15 +00:00
|
|
|
#
|
|
|
|
# Options
|
2020-06-20 16:09:54 +00:00
|
|
|
|
|
|
|
# Valid flags for AQ_FLAGS
|
|
|
|
# AQ_DEBUG = true
|
|
|
|
AQ_RS16 = true
|
|
|
|
AQ_PDA = true
|
|
|
|
|
|
|
|
|
2019-07-14 14:39:15 +00:00
|
|
|
# make EXFLAGS="-D BETA_PDA_AUTOLABEL" // Add compile flags
|
|
|
|
#
|
2020-06-20 16:09:54 +00:00
|
|
|
|
2017-12-30 20:12:01 +00:00
|
|
|
# define the C compiler to use
|
|
|
|
CC = gcc
|
|
|
|
|
2019-08-25 20:57:51 +00:00
|
|
|
#LIBS := -lpthread -lm
|
|
|
|
LIBS := -l pthread -l m
|
2017-12-30 20:12:01 +00:00
|
|
|
#LIBS := -lpthread -lwebsockets
|
|
|
|
|
|
|
|
# debug of not
|
2020-06-01 00:35:17 +00:00
|
|
|
#DBG = -g -O0 -fsanitize=address
|
2020-06-20 16:09:54 +00:00
|
|
|
|
2017-12-30 20:12:01 +00:00
|
|
|
|
2018-08-31 12:49:41 +00:00
|
|
|
# USe below to remove unused functions and global variables.
|
|
|
|
#LFLAGS = -Wl,--gc-sections,--print-gc-sections
|
|
|
|
#GCCFLAGS = -Wall -ffunction-sections -fdata-sections
|
|
|
|
|
2017-12-30 20:12:01 +00:00
|
|
|
# define any compile-time flags
|
2019-06-05 16:41:38 +00:00
|
|
|
#GCCFLAGS = -Wall -O3 -Wextra
|
2019-07-14 14:39:15 +00:00
|
|
|
GCCFLAGS = -Wall -O3 $(EXFLAGS)
|
2019-05-31 23:08:45 +00:00
|
|
|
#GCCFLAGS = -Wall
|
2018-08-25 20:13:33 +00:00
|
|
|
|
2017-12-30 20:12:01 +00:00
|
|
|
#CFLAGS = -Wall -g $(LIBS)
|
|
|
|
#CFLAGS = -Wall -g $(LIBS) -std=gnu11
|
2020-06-20 16:09:54 +00:00
|
|
|
#CFLAGS = $(GCCFLAGS) $(DBG) $(AQ_FLAGS) $(LIBS) -D MG_DISABLE_MD5 -D MG_DISABLE_HTTP_DIGEST_AUTH -D MG_DISABLE_MD5 -D MG_DISABLE_JSON_RPC
|
2018-08-25 20:13:33 +00:00
|
|
|
CFLAGS = $(GCCFLAGS) $(DBG) $(LIBS) -D MG_DISABLE_MD5 -D MG_DISABLE_HTTP_DIGEST_AUTH -D MG_DISABLE_MD5 -D MG_DISABLE_JSON_RPC
|
2017-12-30 20:12:01 +00:00
|
|
|
|
2018-06-06 00:18:44 +00:00
|
|
|
|
2017-12-30 20:12:01 +00:00
|
|
|
# Add inputs and outputs from these tool invocations to the build variables
|
|
|
|
|
|
|
|
# define the C source files
|
2020-06-20 16:09:54 +00:00
|
|
|
#SRCS = aqualinkd.c utils.c config.c aq_serial.c init_buttons.c aq_programmer.c net_services.c json_messages.c pda.c pda_menu.c \
|
|
|
|
# pda_aq_programmer.c devices_jandy.c onetouch.c onetouch_aq_programmer.c packetLogger.c devices_pentair.c color_lights.c mongoose.c
|
|
|
|
|
|
|
|
SRCS = aqualinkd.c utils.c config.c aq_serial.c init_buttons.c aq_programmer.c net_services.c json_messages.c \
|
|
|
|
devices_jandy.c onetouch.c onetouch_aq_programmer.c packetLogger.c devices_pentair.c color_lights.c mongoose.c
|
2019-06-27 22:18:44 +00:00
|
|
|
DBG_SRC = timespec_subtract.c
|
|
|
|
|
2020-06-20 16:09:54 +00:00
|
|
|
ifeq ($(AQ_PDA), true)
|
|
|
|
SRCS := $(SRCS) pda.c pda_menu.c pda_aq_programmer.c
|
|
|
|
CFLAGS := $(CFLAGS) -D AQ_PDA
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(AQ_RS16), true)
|
|
|
|
CFLAGS := $(CFLAGS) -D AQ_RS16
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(AQ_DEBUG), true)
|
|
|
|
DEBUG=true
|
|
|
|
endif
|
|
|
|
|
2019-06-27 22:18:44 +00:00
|
|
|
# If run with `make DEBUG=true` add debug files and pass parameter for compile
|
|
|
|
ifeq ($(DEBUG), true)
|
|
|
|
SRCS := $(SRCS) $(DBG_SRC)
|
2020-06-20 16:09:54 +00:00
|
|
|
CFLAGS := -g -O0 $(CFLAGS) -D AQ_DEBUG
|
2019-06-27 22:18:44 +00:00
|
|
|
endif
|
2017-12-30 20:12:01 +00:00
|
|
|
|
2019-08-18 20:54:10 +00:00
|
|
|
SL_SRC = serial_logger.c aq_serial.c utils.c packetLogger.c
|
2019-10-16 22:53:09 +00:00
|
|
|
LR_SRC = log_reader.c aq_serial.c utils.c packetLogger.c
|
2019-05-31 23:08:45 +00:00
|
|
|
PL_EXSRC = aq_serial.c
|
2019-06-07 21:31:06 +00:00
|
|
|
PL_EXOBJ = aq_serial_player.o
|
2019-05-31 23:08:45 +00:00
|
|
|
PL_SRC := $(filter-out aq_serial.c, $(SRCS))
|
2018-03-15 20:03:57 +00:00
|
|
|
|
2017-12-30 20:12:01 +00:00
|
|
|
OBJS = $(SRCS:.c=.o)
|
2019-05-31 23:08:45 +00:00
|
|
|
|
2018-03-15 20:03:57 +00:00
|
|
|
SL_OBJS = $(SL_SRC:.c=.o)
|
2019-05-31 23:08:45 +00:00
|
|
|
LR_OBJS = $(LR_SRC:.c=.o)
|
|
|
|
PL_OBJS = $(PL_SRC:.c=.o)
|
2017-12-30 20:12:01 +00:00
|
|
|
|
|
|
|
# define the executable file
|
|
|
|
MAIN = ./release/aqualinkd
|
2018-03-15 20:03:57 +00:00
|
|
|
SLOG = ./release/serial_logger
|
2019-05-31 23:08:45 +00:00
|
|
|
LOGR = ./release/log_reader
|
|
|
|
PLAY = ./release/aqualinkd-player
|
2017-12-30 20:12:01 +00:00
|
|
|
|
|
|
|
all: $(MAIN)
|
|
|
|
@echo: $(MAIN) have been compiled
|
|
|
|
|
|
|
|
$(MAIN): $(OBJS)
|
|
|
|
$(CC) $(CFLAGS) $(INCLUDES) -o $(MAIN) $(OBJS) $(LFLAGS) $(LIBS)
|
|
|
|
|
2018-03-15 20:03:57 +00:00
|
|
|
slog: $(SLOG)
|
|
|
|
@echo: $(SLOG) have been compiled
|
|
|
|
|
|
|
|
$(SLOG): $(SL_OBJS)
|
|
|
|
$(CC) $(CFLAGS) $(INCLUDES) -o $(SLOG) $(SL_OBJS)
|
|
|
|
|
2019-05-31 23:08:45 +00:00
|
|
|
logr: $(LOGR)
|
|
|
|
@echo: $(LOGR) have been compiled
|
2018-09-02 21:45:24 +00:00
|
|
|
|
2019-05-31 23:08:45 +00:00
|
|
|
$(LOGR): $(LR_OBJS)
|
|
|
|
$(CC) $(CFLAGS) $(INCLUDES) -o $(LOGR) $(LR_OBJS)
|
2018-09-02 21:45:24 +00:00
|
|
|
|
2019-05-31 23:08:45 +00:00
|
|
|
player: $(PLAY)
|
|
|
|
@echo: $(PLAY) have been compiled
|
2018-09-02 21:45:24 +00:00
|
|
|
|
2019-06-07 21:31:06 +00:00
|
|
|
$(PL_EXOBJ): $(PL_EXSRC)
|
|
|
|
$(CC) $(CFLAGS) -D PLAYBACK_MODE $(INCLUDES) -c $(PL_EXSRC) -o $(PL_EXOBJ)
|
2018-04-18 00:33:17 +00:00
|
|
|
|
2019-06-07 21:31:06 +00:00
|
|
|
$(PLAY): $(PL_OBJS) $(PL_EXOBJ)
|
|
|
|
$(CC) $(CFLAGS) $(INCLUDES) -o $(PLAY) $(PL_OBJS) $(PL_EXOBJ)
|
2018-06-06 00:18:44 +00:00
|
|
|
|
2019-06-29 14:52:41 +00:00
|
|
|
.PHONY: git
|
|
|
|
git: clean $(MAIN) $(SLOG)
|
|
|
|
./release/git_version.sh
|
|
|
|
|
|
|
|
|
2017-12-30 20:12:01 +00:00
|
|
|
# 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 $@
|
|
|
|
|
2019-06-29 14:52:41 +00:00
|
|
|
.PHONY: clean
|
2017-12-30 20:12:01 +00:00
|
|
|
clean:
|
2019-06-27 22:18:44 +00:00
|
|
|
$(RM) *.o *~ $(MAIN) $(MAIN_U) $(PLAY) $(PL_EXOBJ)
|
2019-06-29 14:52:41 +00:00
|
|
|
$(RM) $(wildcard *.o) $(wildcard *~) $(MAIN) $(MAIN_U) $(PLAY) $(PL_EXOBJ) $(LOGR) $(PLAY)
|
2017-12-30 20:12:01 +00:00
|
|
|
|
|
|
|
depend: $(SRCS)
|
|
|
|
makedepend $(INCLUDES) $^
|
|
|
|
|
|
|
|
install: $(MAIN)
|
|
|
|
./release/install.sh
|
2019-05-31 23:08:45 +00:00
|
|
|
|