Debian Codegraph @

Makefile

raw symbols SCIP
1 # Makefile for proxytunnel
2 #
3 # Please uncomment the appropriate settings
4
5 name = proxytunnel
6 version = $(shell awk 'BEGIN { FS="\"" } /^\#define VERSION / { print $$2 }' config.h)
7
8 CC ?= cc
9 CFLAGS ?= -Wall -O2 -ggdb
10
11 # Comment on non-gnu systems
12 OPTFLAGS += -DHAVE_GETOPT_LONG
13
14 # MSYS/CYGWIN
15 # The current version of gcc from MSYS defines __MSYS__ and __CYGWIN__, from CYGWIN defines __CYGWIN__.
16 # To avoid to change the code, simply define CYGWIN additionally.
17 ifneq ($(filter $(shell uname -o),Msys Cygwin),)
18 OPTFLAGS += -DCYGWIN
19 endif
20
21 # Most systems
22 OPTFLAGS += -DSETPROCTITLE -DSPT_TYPE=2
23
24 # System dependant blocks... if your system is listed below, uncomment
25 # the relevant lines
26
27 # OpenBSD
28 #OPTFLAGS += -DHAVE_SYS_PSTAT_H
29
30 # DARWIN
31 #OPTFLAGS += -DDARWIN
32
33 # DARWIN, continued, if compiling for macOS with Homebrew
34 #CFLAGS += -I/usr/local/opt/openssl/include
35 #LDFLAGS += -L/usr/local/opt/openssl/lib
36 #OPTFLAGS += -DDEFAULT_CA_FILE='"/usr/local/etc/[email protected]/cacert.pem"'
37 #OPTFLAGS += -DDEFAULT_CA_DIR=NULL
38
39 # SOLARIS
40 #LDFLAGS += -lsocket -lnsl
41 #LDFLAGS += -L/usr/local/ssl/lib # Path to your SSL lib dir
42
43 # END system dependant block
44
45 SSL_LIBS := $(shell pkg-config --libs openssl 2>/dev/null)
46 ifeq ($(SSL_LIBS),)
47 SSL_LIBS := $(shell pkg-config --libs libssl 2>/dev/null)
48 endif
49 ifeq ($(SSL_LIBS),)
50 SSL_LIBS := -lssl -lcrypto
51 endif
52 LDFLAGS += $(SSL_LIBS)
53
54 prefix = /usr/local
55 bindir = $(prefix)/bin
56 datadir = $(prefix)/share
57 mandir = $(datadir)/man
58
59 # Remove strlcpy/strlcat on (open)bsd/darwin systems
60 OBJ = proxytunnel.o \
61 base64.o \
62 strzcat.o \
63 io.o \
64 http.o \
65 basicauth.o \
66 readpassphrase.o \
67 messages.o \
68 cmdline.o \
69 globals.o \
70 ntlm.o \
71 ptstream.o
72
73 ifneq (,$(findstring -DSETPROCTITLE,$(OPTFLAGS)))
74 OBJ += setproctitle.o
75 endif
76
77 UNAME = $(shell uname)
78 ifneq ($(UNAME),Darwin)
79 OBJ += strlcpy.o \
80 strlcat.o
81 endif
82
83 .PHONY: all clean docs install
84
85 all: proxytunnel
86
87 docs:
88 $(MAKE) -C docs
89
90 proxytunnel: $(OBJ)
91 $(CC) -o $(name) $(CPPFLAGS) $(CFLAGS) $(OPTFLAGS) $(OBJ) $(LDFLAGS)
92
93 clean:
94 @rm -f $(name) $(OBJ)
95 $(MAKE) -C docs clean
96
97 install:
98 install -d $(DESTDIR)$(bindir)
99 install -p -m555 $(name) $(DESTDIR)$(bindir)
100 $(MAKE) -C docs install
101
102 %.o: %.c
103 $(CC) $(CPPFLAGS) $(CFLAGS) $(OPTFLAGS) -c -o $@ $<
104
105 dist: clean docs
106 sed -i -e 's/^Version:.*$$/Version: $(version)/' contrib/proxytunnel.spec
107 find . ! -wholename '*/.svn*' | pax -d -w -x ustar -s ,^./,$(name)-$(version)/, | bzip2 >../$(name)-$(version).tar.bz2
108
109 rpm: dist
110 rpmbuild -tb --clean --rmsource --rmspec --define "_rpmfilename %%{NAME}-%%{VERSION}-%%{RELEASE}.%%{ARCH}.rpm" --define "_rpmdir ../" ../$(name)-$(version).tar.bz2
111
112 srpm: dist
113 rpmbuild -ts --clean --rmsource --rmspec --define "_rpmfilename %%{NAME}-%%{VERSION}-%%{RELEASE}.%%{ARCH}.rpm" --define "_srcrpmdir ../" ../$(name)-$(version).tar.bz2