1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
|
DESTDIR=
PREFIX=/usr
BINDIR=$(PREFIX)/sbin
MANDIR=$(PREFIX)/share/man
BIN_TARGET = dlm_stonith
MAN_TARGET = dlm_stonith.8
BIN_SOURCE = stonith_helper.c
BIN_CFLAGS += -D_GNU_SOURCE -O2 -ggdb \
-Wall \
-Wformat \
-Wformat-security \
-Wmissing-prototypes \
-Wnested-externs \
-Wpointer-arith \
-Wextra -Wshadow \
-Wcast-align \
-Wwrite-strings \
-Waggregate-return \
-Wstrict-prototypes \
-Winline \
-Wredundant-decls \
-Wno-sign-compare \
-Wno-unused-parameter \
-Wp,-D_FORTIFY_SOURCE=2 \
-fexceptions \
-fasynchronous-unwind-tables \
-fdiagnostics-show-option \
BIN_CFLAGS += -fPIE -DPIE
# pacemaker/crm/stonith-ng.h includes libxml/tree.h, so we need this:
BIN_CFLAGS += `xml2-config --cflags`
BIN_CFLAGS += -I../include
BIN_LDFLAGS += -Wl,-z,now -Wl,-z,relro -pie
BIN_LDFLAGS += -ldl
all: $(BIN_TARGET)
$(BIN_TARGET): $(BIN_SOURCE)
$(CC) $(CPPFLAGS) $(BIN_SOURCE) $(BIN_CFLAGS) $(CFLAGS) $(BIN_LDFLAGS) $(LDFLAGS) -o $@ -L.
clean:
rm -f *.o *.so *.so.* $(BIN_TARGET)
INSTALL=$(shell which install)
.PHONY: install
install: all
$(INSTALL) -d $(DESTDIR)/$(BINDIR)
$(INSTALL) -d $(DESTDIR)/$(MANDIR)/man8
$(INSTALL) -c -m 755 $(BIN_TARGET) $(DESTDIR)/$(BINDIR)
$(INSTALL) -m 644 $(MAN_TARGET) $(DESTDIR)/$(MANDIR)/man8/
|