AqualinkD/Makefile

93 lines
2.4 KiB
Makefile
Raw Normal View History

2017-12-30 20:12:01 +00:00
# define the C compiler to use
CC = gcc
LIBS := -lpthread -lm
#LIBS := -lpthread -lwebsockets
# debug of not
2019-05-29 13:46:07 +00:00
#DBG = -g -O0 -fsanitize=address -static-libasan
2019-05-18 14:21:52 +00:00
#DBG = -g
DBG =
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-05-31 23:08:45 +00:00
GCCFLAGS = -Wall -O3
#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
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
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
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 pentair_messages.c mongoose.c timespec_subtract.c
2017-12-30 20:12:01 +00:00
2018-03-15 20:03:57 +00:00
SL_SRC = serial_logger.c aq_serial.c utils.c
2019-05-31 23:08:45 +00:00
LR_SRC = log_reader.c aq_serial.c utils.c
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)
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 $@
clean:
$(RM) $(wildcard *.o) $(wildcard *~) $(MAIN) $(MAIN_U) $(PLAY) $(PL_EXOBJ)
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