core: use string instead of compound literal
[rofl0r-proxychains-ng.git] / Makefile
blob11d0df85df391c5a0d6fd30c42054e487eb3a2ae
2 # Makefile for proxychains (requires GNU make), stolen from musl
4 # Use config.mak to override any of the following variables.
5 # Do not make changes here.
8 exec_prefix = /usr/local
9 bindir = $(exec_prefix)/bin
11 prefix = /usr/local/
12 includedir = $(prefix)/include
13 libdir = $(prefix)/lib
14 sysconfdir = $(prefix)/etc
15 zshcompletiondir = $(prefix)/share/zsh/site-functions
17 OBJS = src/common.o src/main.o
19 DOBJS = src/daemon/hsearch.o \
20 src/daemon/sblist.o src/daemon/sblist_delete.o \
21 src/daemon/daemon.o src/daemon/udpserver.o
23 LOBJS = src/version.o \
24 src/core.o src/common.o src/libproxychains.o \
25 src/allocator_thread.o src/rdns.o \
26 src/hostsreader.o src/hash.o src/debug.o
29 GENH = src/version.h
31 CFLAGS += -Wall -O0 -g -std=c99 -D_GNU_SOURCE -pipe
32 NO_AS_NEEDED = -Wl,--no-as-needed
33 LDFLAGS = -fPIC $(NO_AS_NEEDED) $(LIBDL) $(PTHREAD)
34 INC =
35 PIC = -fPIC
36 AR = $(CROSS_COMPILE)ar
37 RANLIB = $(CROSS_COMPILE)ranlib
38 SOCKET_LIBS =
40 LDSO_SUFFIX = so
41 LD_SET_SONAME = -Wl,-soname=
42 INSTALL = ./tools/install.sh
44 LDSO_PATHNAME = libproxychains4.$(LDSO_SUFFIX)
46 SHARED_LIBS = $(LDSO_PATHNAME)
47 ALL_LIBS = $(SHARED_LIBS)
48 PXCHAINS = proxychains4
49 PXCHAINS_D = proxychains4-daemon
50 ALL_TOOLS = $(PXCHAINS) $(PXCHAINS_D)
51 ALL_CONFIGS = src/proxychains.conf
52 ZSH_COMPLETION = completions/zsh/_proxychains4
54 -include config.mak
56 CFLAGS+=$(USER_CFLAGS) $(MAC_CFLAGS)
57 CFLAGS_MAIN=-DLIB_DIR=\"$(libdir)\" -DSYSCONFDIR=\"$(sysconfdir)\" -DDLL_NAME=\"$(LDSO_PATHNAME)\"
60 all: $(ALL_LIBS) $(ALL_TOOLS)
62 install: install-libs install-tools
64 $(DESTDIR)$(bindir)/%: %
65 $(INSTALL) -D -m 755 $< $@
67 $(DESTDIR)$(libdir)/%: %
68 $(INSTALL) -D -m 644 $< $@
70 $(DESTDIR)$(sysconfdir)/%: src/%
71 $(INSTALL) -D -m 644 $< $@
73 $(DESTDIR)$(zshcompletiondir)/%: completions/zsh/%
74 $(INSTALL) -D -m 644 $< $@
76 install-libs: $(ALL_LIBS:%=$(DESTDIR)$(libdir)/%)
77 install-tools: $(ALL_TOOLS:%=$(DESTDIR)$(bindir)/%)
78 install-config: $(ALL_CONFIGS:src/%=$(DESTDIR)$(sysconfdir)/%)
79 install-zsh-completion: $(ZSH_COMPLETION:completions/zsh/%=$(DESTDIR)$(zshcompletiondir)/%)
81 clean:
82 rm -f $(ALL_LIBS)
83 rm -f $(ALL_TOOLS)
84 rm -f $(OBJS) $(LOBJS) $(DOBJS)
85 rm -f $(GENH)
87 src/version.h: $(wildcard VERSION .git)
88 printf '#define VERSION "%s"\n' "$$(sh tools/version.sh)" > $@
90 src/version.o: src/version.h
92 %.o: %.c
93 $(CC) $(CPPFLAGS) $(CFLAGS) $(CFLAGS_MAIN) $(INC) $(PIC) -c -o $@ $<
95 $(LDSO_PATHNAME): $(LOBJS)
96 $(CC) $(LDFLAGS) $(FAT_LDFLAGS) $(LD_SET_SONAME)$(LDSO_PATHNAME) \
97 $(USER_LDFLAGS) -shared -o $@ $^ $(SOCKET_LIBS)
99 $(PXCHAINS): $(OBJS)
100 $(CC) $^ $(FAT_BIN_LDFLAGS) $(USER_LDFLAGS) $(LIBDL) -o $@
102 $(PXCHAINS_D): $(DOBJS)
103 $(CC) $^ $(FAT_BIN_LDFLAGS) $(USER_LDFLAGS) -o $@
106 .PHONY: all clean install install-config install-libs install-tools install-zsh-completion