siahsd/Makefile

34 lines
845 B
Makefile

LIBS := \
dbi \
glib-2.0 \
gmp \
hogweed \
nettle \
talloc \
tevent
CC := gcc
CFLAGS := -O -g -ggdb -std=gnu99 -Wall -Wextra -Winit-self -Wformat-security -Wshadow -pedantic -Wpointer-arith -Wcast-align -Wwrite-strings -Wno-unused-parameter -Werror-implicit-function-declaration -Wstrict-prototypes -fPIC -pie -fstack-protector -D_FORTIFY_SOURCE=2
LDFLAGS := -fPIC -pie -z relro -z now -fstack-protector
SRCDIR=src
BUILD=build
CFLAGS += $(shell pkg-config --cflags $(LIBS))
LDFLAGS += $(shell pkg-config --libs $(LIBS))
$(BUILD)/%.o: $(SRCDIR)/%.c
@echo [CC] $@
@mkdir -p `dirname $@`
@$(CC) -o $@ -c $< $(CFLAGS)
$(BUILD)/siahsd: $(patsubst %, $(BUILD)/%.o, siahsd database config status sia siahs jsonbot hook_script)
@echo [LD] $@
@$(CC) $(LDFLAGS) -o $@ $^
.PHONY: all clean
all: $(BUILD)/siahsd
clean:
@rm -rf $(BUILD)