Test Makefile

This commit is contained in:
Bogomil Vasilev
2017-08-22 15:28:07 +03:00
parent 66aefa166e
commit 2ded8ef7dd

View File

@@ -1,24 +1,28 @@
CC ?= cc
OLEVEL ?= -O2
WFLAGS ?= -Wall \
-Wextra \
-Wmissing-declarations \
-pedantic
SQLCCFLAGS ?= $(shell mysql_config --cflags)
CCFLAGS += -pipe \
-fstack-protector-strong \
$(CFLAGS)
SQLCFLAGS ?= $(shell mysql_config --cflags)
SQLLDFLAGS += $(shell mysql_config --libs)
ifndef CFLAGS
OLEVEL ?= -O2
CFLAGS += -pipe \
-fstack-protector-strong \
$(OLEVEL) $(WFLAGS)
endif
# Use this to store compile flags and debug info.
# You may simply check the flags later with:
# $ readelf -p .GCC.command.line rmpsd
ifeq ($(DEBUG), yes)
CCFLAGS += -frecord-gcc-switches -g
CFLAGS += -frecord-gcc-switches -g
endif
ifndef LDFLAGS
LDFLAGS = -O1 -lcrypto -lssl -lpthread
LDFLAGS += -Wl,-z,relro,-z,now
endif
LDFLAGS = -O1 -lcrypto -lssl -lpthread
LDFLAGS += -Wl,-z,relro,-z,now $(LFLAGS)
SQLLDFLAGS += $(shell mysql_config --libs)
SOURCES = main.c \
confparser.c \
@@ -37,15 +41,19 @@ INSTALLDIR := $(DESTDIR)/usr/bin
all: $(SOURCES) $(EXECUTABLE)
$(EXECUTABLE): $(OBJECTS)
ifeq ($(VERBOSE), yes)
$(CC) $(LDFLAGS) $(SQLLDFLAGS) $(OBJECTS) -o $@
else
@echo ' LD $@'
@$(CC) $(LDFLAGS) $(SQLLDFLAGS) $(OBJECTS) -o $@
endif
.c.o:
ifeq ($(VERBOSE), yes)
$(CC) $(CCFLAGS) $(WFLAGS) $(SQLCCFLAGS) $(OLEVEL) -c $< -o $@
$(CC) $(CFLAGS) $(SQLCFLAGS) -c $< -o $@
else
@echo ' CC $@'
@$(CC) $(CCFLAGS) $(WFLAGS) $(SQLCCFLAGS) $(OLEVEL) -c $< -o $@
@$(CC) $(CFLAGS) $(SQLCFLAGS) -c $< -o $@
endif
clean: