summaryrefslogtreecommitdiff
path: root/GNUmakefile
diff options
context:
space:
mode:
Diffstat (limited to 'GNUmakefile')
-rw-r--r--GNUmakefile34
1 files changed, 34 insertions, 0 deletions
diff --git a/GNUmakefile b/GNUmakefile
new file mode 100644
index 0000000..4e6007a
--- /dev/null
+++ b/GNUmakefile
@@ -0,0 +1,34 @@
+PREFIX ?= /usr/local
+includedir ?= /include
+bindir ?= /bin
+mandir ?= /share/man/man1
+docdir ?= /share/doc
+
+MAKEFLAGS += --no-builtin-rules
+
+WARNINGS = -Wall -Wextra -Wpedantic -Wformat=2 -Wstrict-aliasing=3 -Wstrict-overflow=5 -Wstack-usage=12500 \
+ -Wfloat-equal -Wcast-align -Wpointer-arith -Wchar-subscripts -Warray-bounds=2 -Wno-unknown-warning-option
+
+override CFLAGS ?= -g -O2 $(WANRINGS)
+override CFLAGS += -std=c99
+override CPPFLAGS ?= -D_FORTIFY_SOURCE=2
+override CPPFLAGS += -D_DEFAULT_SOURCE
+
+all: physfs-serve
+
+%.a: %.c
+ $(LINK.c) -c $(filter %.c,$^) $(LDLIBS) -o $@
+
+libphysfs-serve.a: private override CPPFLAGS += $(shell pkg-config --cflags-only-I physfs)
+libphysfs-serve.a: libphysfs-serve.h
+
+physfs-serve: private override LDLIBS += $(shell pkg-config --libs physfs)
+physfs-serve: libphysfs-serve.a physfs-serve.c
+ $(LINK.c) $(filter %.c %.a,$^) $(LDLIBS) -o $@
+
+install: all
+ install -Dm 755 physfs-serve $(DESTDIR)$(PREFIX)$(bindir)/physfs-serve
+ install -Dm 644 libphysfs-serve.a $(DESTDIR)$(PREFIX)$(libdir)/libphysfs-serve.a
+
+clean:
+ $(RM) physfs-serve libphysfs-serve.a