Test Makefile
This commit is contained in:
26
Makefile
26
Makefile
@@ -1,24 +1,28 @@
|
||||
CC ?= cc
|
||||
OLEVEL ?= -O2
|
||||
WFLAGS ?= -Wall \
|
||||
-Wextra \
|
||||
-Wmissing-declarations \
|
||||
-pedantic
|
||||
SQLCCFLAGS ?= $(shell mysql_config --cflags)
|
||||
CCFLAGS += -pipe \
|
||||
SQLCFLAGS ?= $(shell mysql_config --cflags)
|
||||
SQLLDFLAGS += $(shell mysql_config --libs)
|
||||
ifndef CFLAGS
|
||||
OLEVEL ?= -O2
|
||||
CFLAGS += -pipe \
|
||||
-fstack-protector-strong \
|
||||
$(CFLAGS)
|
||||
$(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 $(LFLAGS)
|
||||
SQLLDFLAGS += $(shell mysql_config --libs)
|
||||
LDFLAGS += -Wl,-z,relro,-z,now
|
||||
endif
|
||||
|
||||
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:
|
||||
|
||||
Reference in New Issue
Block a user