diff options
Diffstat (limited to 'src/prog.mk')
-rw-r--r-- | src/prog.mk | 28 |
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 | |||
5 | HDRS := $(sort $(wildcard *.h)) $(MOD_HDRS) | ||
6 | SRCS := $(sort $(wildcard *.c)) $(MOD_SRCS) | ||
7 | OBJS := $(SRCS:.c=.o) $(MOD_OBJS) | ||
8 | |||
9 | CFLAGS += -ggdb $(HAVE_FATAL_WARNINGS) -O2 -DVERSION='"$(VERSION)"' $(HAVE_GCOV) | ||
10 | CFLAGS += -DPREFIX='"$(prefix)"' -DSYSCONFDIR='"$(sysconfdir)/firejail"' -DLIBDIR='"$(libdir)"' -DBINDIR='"$(bindir)"' -DVARDIR='"/var/lib/firejail"' | ||
11 | CFLAGS += $(MANFLAGS) | ||
12 | CFLAGS += -fstack-protector-all -D_FORTIFY_SOURCE=2 -fPIE -Wformat -Wformat-security | ||
13 | LDFLAGS += -pie -fPIE -Wl,-z,relro -Wl,-z,now | ||
14 | |||
15 | .PHONY: all | ||
16 | all: $(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 | ||
25 | clean:; rm -fr *.o $(PROG) *.gcov *.gcda *.gcno *.plist | ||
26 | |||
27 | .PHONY: distclean | ||
28 | distclean: clean | ||