aboutsummaryrefslogtreecommitdiffstats
path: root/src/prog.mk
diff options
context:
space:
mode:
Diffstat (limited to 'src/prog.mk')
-rw-r--r--src/prog.mk28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/prog.mk b/src/prog.mk
new file mode 100644
index 000000000..6ec216b46
--- /dev/null
+++ b/src/prog.mk
@@ -0,0 +1,28 @@
1# Common definitions for building C programs and non-shared objects.
2#
3# Note: $(ROOT)/config.mk must be included before this file.
4
5HDRS := $(sort $(wildcard *.h)) $(MOD_HDRS)
6SRCS := $(sort $(wildcard *.c)) $(MOD_SRCS)
7OBJS := $(SRCS:.c=.o) $(MOD_OBJS)
8
9CFLAGS += -ggdb $(HAVE_FATAL_WARNINGS) -O2 -DVERSION='"$(VERSION)"' $(HAVE_GCOV)
10CFLAGS += -DPREFIX='"$(prefix)"' -DSYSCONFDIR='"$(sysconfdir)/firejail"' -DLIBDIR='"$(libdir)"' -DBINDIR='"$(bindir)"' -DVARDIR='"/var/lib/firejail"'
11CFLAGS += $(MANFLAGS)
12CFLAGS += -fstack-protector-all -D_FORTIFY_SOURCE=2 -fPIE -Wformat -Wformat-security
13LDFLAGS += -pie -fPIE -Wl,-z,relro -Wl,-z,now
14
15.PHONY: all
16all: $(TARGET)
17
18%.o : %.c $(HDRS) $(ROOT)/config.mk
19 $(CC) $(CFLAGS) $(EXTRA_CFLAGS) $(INCLUDE) -c $< -o $@
20
21$(PROG): $(OBJS) $(ROOT)/config.mk
22 $(CC) $(LDFLAGS) -o $@ $(OBJS) $(LIBS) $(EXTRA_LDFLAGS)
23
24.PHONY: clean
25clean:; rm -fr *.o $(PROG) *.gcov *.gcda *.gcno *.plist
26
27.PHONY: distclean
28distclean: clean