blob: 84f43142d8e8337c39c36518c37cfc6b2a32475a (
plain) (
blame)
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
|
# Common definitions for building C programs and non-shared objects.
#
# Note: $(ROOT)/config.mk must be included before this file.
#
# The includer should probably define PROG and TARGET and may also want to
# define MOD_HDRS, MOD_SRCS, MOD_OBJS, TOCLEAN and TODISTCLEAN.
HDRS := $(sort $(wildcard *.h)) $(MOD_HDRS)
SRCS := $(sort $(wildcard *.c)) $(MOD_SRCS)
OBJS := $(SRCS:.c=.o) $(MOD_OBJS)
CFLAGS += \
-ggdb $(HAVE_FATAL_WARNINGS) -O2 -DVERSION='"$(VERSION)"' \
-fstack-protector-all -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security \
-fPIE \
-DPREFIX='"$(prefix)"' -DSYSCONFDIR='"$(sysconfdir)/firejail"' \
-DLIBDIR='"$(libdir)"' -DBINDIR='"$(bindir)"' \
-DVARDIR='"/var/lib/firejail"' \
$(HAVE_GCOV) $(MANFLAGS)
LDFLAGS += -pie -fPIE -Wl,-z,relro -Wl,-z,now
.PHONY: all
all: $(TARGET)
%.o : %.c $(HDRS) $(ROOT)/config.mk
$(CC) $(CFLAGS) $(EXTRA_CFLAGS) $(INCLUDE) -c $< -o $@
$(PROG): $(OBJS) $(ROOT)/config.mk
$(CC) $(LDFLAGS) -o $@ $(OBJS) $(LIBS) $(EXTRA_LDFLAGS)
.PHONY: clean
clean:; rm -fr *.o $(PROG) *.gcov *.gcda *.gcno *.plist $(TOCLEAN)
.PHONY: distclean
distclean: clean; rm -fr $(TODISTCLEAN)
|