2021-03-11 12:48:15 -05:00
|
|
|
INLINE_SQLITE ?= 0
|
2021-03-11 17:23:43 -05:00
|
|
|
WARN := -W -Wall -Wextra -pedantic -pedantic-errors
|
2021-03-11 12:48:15 -05:00
|
|
|
|
|
|
|
CC ?= gcc
|
|
|
|
|
2021-03-11 17:23:43 -05:00
|
|
|
SRC := $(wildcard *.c)
|
|
|
|
OBJ := $(SRC:.c=.o)
|
2021-03-08 16:59:27 -05:00
|
|
|
|
2021-03-11 12:48:15 -05:00
|
|
|
ifeq ($(INLINE_SQLITE),0)
|
|
|
|
TMP := $(OBJ)
|
|
|
|
OBJ := $(filter-out sqlite3.o,$(TMP))
|
|
|
|
LDFLAGS += -lsqlite3
|
|
|
|
endif
|
2021-03-09 01:39:19 -05:00
|
|
|
|
2021-03-11 20:48:32 -05:00
|
|
|
OPT := -ggdb -O0
|
|
|
|
|
|
|
|
ifeq ($(O),1)
|
|
|
|
OPT := -g -O1
|
2021-03-31 08:47:18 -04:00
|
|
|
else ifeq ($(O),2)
|
|
|
|
OPT := -g0 -O2
|
|
|
|
else ifeq ($(O),s)
|
|
|
|
OPT := -g0 -Os
|
2021-03-11 20:48:32 -05:00
|
|
|
endif
|
|
|
|
|
2021-03-31 08:47:18 -04:00
|
|
|
ifeq ($(LTO),1)
|
|
|
|
LDFLAGS += -funroll-loops -flto -fwhole-program
|
2021-03-11 20:48:32 -05:00
|
|
|
endif
|
|
|
|
|
2021-03-31 08:47:18 -04:00
|
|
|
ifeq ($(PROF),1)
|
|
|
|
DEBUG += --coverage -pg
|
|
|
|
LDFLAGS += -lgcov
|
2021-03-11 20:48:32 -05:00
|
|
|
endif
|
|
|
|
|
2021-03-31 08:47:18 -04:00
|
|
|
F := -Wl,-z,defs -Wl,-z,now -Wl,-z,relro -fpie -Wl,-pie -fpic -fstack-clash-protection -fstack-protector-all -fstack-protector-strong
|
|
|
|
FLAGS := -D_FORTIFY_SOURCE=2 -fasynchronous-unwind-tables -fexceptions -g -grecord-gcc-switches -fcf-protection -pipe -Wformat -Werror=format-security -Werror=implicit-function-declaration
|
2021-03-12 12:41:17 -05:00
|
|
|
CFLAGS += $(FLAGS)
|
|
|
|
LDFLAGS += $(FLAGS)
|
|
|
|
|
2021-03-11 20:48:32 -05:00
|
|
|
CFLAGS += $(OPT) -std=c99 $(WARN)
|
2021-03-11 17:23:43 -05:00
|
|
|
CFLAGS += -I.
|
|
|
|
|
2021-03-11 20:48:32 -05:00
|
|
|
LDFLAGS += -lircclient -lpthread
|
2021-03-11 17:23:43 -05:00
|
|
|
|
2021-03-08 16:59:27 -05:00
|
|
|
all: spammer
|
|
|
|
|
2021-03-11 12:48:15 -05:00
|
|
|
sqlite3.o: sqlite3.c
|
|
|
|
$(CC) -c $< -o $@ $(LDFLAGS)
|
|
|
|
|
2021-03-09 01:39:19 -05:00
|
|
|
spammer: $(OBJ)
|
2021-03-08 23:16:14 -05:00
|
|
|
$(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS)
|
2021-03-08 16:59:27 -05:00
|
|
|
|
|
|
|
clean:
|
2021-03-11 20:48:32 -05:00
|
|
|
$(RM) -rf spammer db a.out *.o *.db *.sqlite3 *.exe *.dll
|