aboutsummaryrefslogtreecommitdiffstats
path: root/src/so.mk
diff options
context:
space:
mode:
Diffstat (limited to 'src/so.mk')
-rw-r--r--src/so.mk25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/so.mk b/src/so.mk
new file mode 100644
index 000000000..bca127f93
--- /dev/null
+++ b/src/so.mk
@@ -0,0 +1,25 @@
1# Common definitions for making 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)"' -fstack-protector-all -D_FORTIFY_SOURCE=2 -fPIC -Wformat -Wformat-security
10LDFLAGS += -pie -fPIE -Wl,-z,relro -Wl,-z,now
11
12.PHONY: all
13all: $(TARGET)
14
15%.o : %.c $(HDRS) $(ROOT)/config.mk
16 $(CC) $(CFLAGS) $(INCLUDE) -c $< -o $@
17
18$(SO): $(OBJS) $(ROOT)/config.mk
19 $(CC) $(LDFLAGS) -shared -fPIC -z relro -o $@ $(OBJS) -ldl
20
21.PHONY: clean
22clean:; rm -fr $(OBJS) $(SO) *.plist
23
24.PHONY: distclean
25distclean: clean