2 # Copyright Gerhard Rieger and contributors (see file CHANGES)
3 # Published under the GNU General Public License V.2, see file COPYING
5 # note: @...@ forms are filled in by configure script
14 exec_prefix = @
exec_prefix@
18 datarootdir
= @datarootdir@
25 #CCOPT1=-no-pie -fstack-protector
26 #CCOPT=$(CCOPT1) -fcf-protection=none # for gdb on Ubuntu-20.04
30 CPPFLAGS
= -I. @CPPFLAGS@
31 #0 INCLS = -I. @V_INCL@
38 #OBJ = $(CSRC:.c=.o) $(GENSRC:.c=.o) @LIBOBJS@
41 #0 CFLAGS = @CFLAGS@ $(CCOPTS) $(DEFS) $(INCLS)
42 CFLAGS
= @CFLAGS@
$(CCOPTS
) $(DEFS
) $(CPPFLAGS
)
44 #CLIBS = $(LIBS) -lm -lefence
45 XIOSRCS
= xioinitialize.c xiohelp.c xioparam.c xiodiag.c xioopen.c xioopts.c \
46 xiosignal.c xiosigchld.c xioread.c xiowrite.c \
47 xiolayer.c xioshutdown.c xioclose.c xioexit.c \
48 xio-process.c xio-fd.c xio-fdnum.c xio-stdio.c xio-pipe.c \
49 xio-socketpair.c xio-gopen.c xio-creat.c xio-file.c xio-named.c \
50 xio-socket.c xio-interface.c xio-listen.c xio-unix.c xio-vsock.c \
51 xio-ip.c xio-ip4.c xio-ip6.c xio-ipapp.c xio-tcp.c \
52 xio-sctp.c xio-dccp.c xio-rawip.c xio-posixmq.c \
53 xio-socks.c xio-socks5.c xio-proxy.c xio-udp.c xio-udplite.c \
54 xio-progcall.c xio-exec.c xio-system.c xio-shell.c \
55 xio-termios.c xio-readline.c \
56 xio-pty.c xio-openssl.c xio-streams.c xio-namespaces.c \
57 xio-ascii.c xiolockfile.c xio-tcpwrap.c xio-fs.c xio-tun.c
58 XIOOBJS
= $(XIOSRCS
:.c
=.o
)
59 UTLSRCS
= error.c dalan.c procan.c procan-cdefs.c hostan.c fdname.c sysutils.c utils.c nestlex.c vsnprintf_r.c snprinterr.c @FILAN@ sycls.c @SSLCLS@
60 UTLOBJS
= $(UTLSRCS
:.c
=.o
)
61 CFILES
= $(XIOSRCS
) $(UTLSRCS
) socat.c procan_main.c filan_main.c
62 OFILES
= $(CFILES
:.c
=.o
)
63 PROGS
= socat procan filan
65 HFILES
= sycls.h sslcls.h error.h dalan.h procan.h filan.h hostan.h sysincludes.h xio.h xioopen.h sysutils.h utils.h nestlex.h vsnprintf_r.h snprinterr.h compat.h \
66 xioconfig.h mytypes.h xioopts.h xiodiag.h xiohelp.h xiosysincludes.h \
67 xiomodes.h xiolayer.h xio-process.h xio-fd.h xio-fdnum.h xio-stdio.h \
68 xio-named.h xio-file.h xio-creat.h xio-gopen.h xio-pipe.h \
69 xio-socketpair.h xio-socket.h xio-interface.h xio-listen.h xio-unix.h xio-vsock.h \
70 xio-ip.h xio-ip4.h xio-ip6.h xio-rawip.h xio-posixmq.h \
71 xio-ipapp.h xio-tcp.h xio-udp.h xio-sctp.h xio-dccp.h xio-udplite.h \
72 xio-socks.h xio-socks5.h xio-proxy.h xio-progcall.h xio-exec.h \
73 xio-system.h xio-shell.h xio-termios.h xio-readline.h \
74 xio-pty.h xio-openssl.h xio-streams.h xio-namespaces.h \
75 xio-ascii.h xiolockfile.h xio-tcpwrap.h xio-fs.h xio-tun.h
78 DOCFILES
= README README.FIPS CHANGES FILES EXAMPLES PORTING SECURITY DEVELOPMENT doc
/socat.yo doc
/socat
.1 doc
/socat.html FAQ BUGREPORTS COPYING COPYING.OpenSSL doc
/dest-unreach.css doc
/socat-openssltunnel.html doc
/socat-multicast.html doc
/socat-tun.html doc
/socat-genericsocket.html
79 SHFILES
= socat-chain.sh socat-mux.sh socat-broker.sh \
80 daemon.sh mail.sh ftp.sh readline.sh \
81 socat_buildscript_for_android.sh
82 TESTFILES
= test.sh socks4echo.sh proxyecho.sh readline-test.sh \
83 proxy.sh socks4a-echo.sh
89 gitclean
: distclean docclean
90 rm -f Makefile.bak configure
92 doc
: doc
/socat
.1 doc
/socat.html
95 rm -f doc
/socat
.1 doc
/socat.html
97 doc
/socat
.1: doc
/socat.yo
98 -mkdir
-p
$(@D
); yodl2man
-o
$@
$+
100 doc
/socat.html
: doc
/socat.yo
101 # care for refs in html
102 -mkdir
-p
$(@D
); cd
$(@D
); yodl2html
-o socat.html ..
/$+; cd ..
106 depend
: $(CFILES
) $(HFILES
)
107 makedepend
$(SYSDEFS
) $(CFILES
)
109 socat
: socat.o libxio.a
110 $(CC
) $(CFLAGS
) $(LDFLAGS
) -o
$@ socat.o libxio.a
$(CLIBS
)
112 procan.o
: $(srcdir)/procan.c
113 $(CC
) $(CFLAGS
) -c
-D CC
="\"$(CC)\"" -o
$@
$(srcdir)/procan.c
115 PROCAN_OBJS
=procan_main.o procan.o procan-cdefs.o hostan.o error.o sycls.o sysutils.o utils.o vsnprintf_r.o snprinterr.o
116 procan
: $(PROCAN_OBJS
)
117 $(CC
) $(CFLAGS
) $(LDFLAGS
) -o
$@
$(PROCAN_OBJS
) $(CLIBS
)
119 FILAN_OBJS
=filan_main.o filan.o fdname.o error.o sycls.o sysutils.o utils.o vsnprintf_r.o snprinterr.o
121 $(CC
) $(CFLAGS
) $(LDFLAGS
) -o
$@
$(FILAN_OBJS
) $(CLIBS
)
123 libxio.a
: $(XIOOBJS
) $(UTLOBJS
)
124 $(AR
) r
$@
$(XIOOBJS
) $(UTLOBJS
)
131 install: progs
$(srcdir)/doc
/socat
.1
132 mkdir
-p
$(DESTDIR
)$(BINDEST
)
133 $(INSTALL
) -m
755 socat
$(DESTDIR
)$(BINDEST
)/socat1
134 ln
-sf socat1
$(DESTDIR
)$(BINDEST
)/socat
135 $(INSTALL
) -m
755 socat-chain.sh
$(DESTDIR
)$(BINDEST
)
136 $(INSTALL
) -m
755 socat-mux.sh
$(DESTDIR
)$(BINDEST
)
137 $(INSTALL
) -m
755 socat-broker.sh
$(DESTDIR
)$(BINDEST
)
138 $(INSTALL
) -m
755 procan
$(DESTDIR
)$(BINDEST
)
139 $(INSTALL
) -m
755 filan
$(DESTDIR
)$(BINDEST
)
140 mkdir
-p
$(DESTDIR
)$(MANDEST
)/man1
141 $(INSTALL
) -m
644 $(srcdir)/doc
/socat
.1 $(DESTDIR
)$(MANDEST
)/man1
/socat1.1
142 ln
-sf socat1.1
$(DESTDIR
)$(MANDEST
)/man1
/socat
.1
145 rm -f
$(DESTDIR
)$(BINDEST
)/socat
146 rm -f
$(DESTDIR
)$(BINDEST
)/socat1
147 rm -f
$(DESTDIR
)$(BINDEST
)/socat-chain.sh
148 rm -f
$(DESTDIR
)$(BINDEST
)/socat-mux.sh
149 rm -f
$(DESTDIR
)$(BINDEST
)/socat-broker.sh
150 rm -f
$(DESTDIR
)$(BINDEST
)/procan
151 rm -f
$(DESTDIR
)$(BINDEST
)/filan
152 rm -f
$(DESTDIR
)$(MANDEST
)/man1
/socat
.1
153 rm -f
$(DESTDIR
)$(MANDEST
)/man1
/socat1.1
155 # make a GNU-zipped tar ball of the source files
156 dist: socat.
tar.gz socat.
tar.bz2
158 socat.
tar.gz
: socat.
tar
159 gzip
-9 <socat.
tar >socat.
tar.gz
161 socat.
tar.bz2
: socat.
tar
162 bzip2
-9 <socat.
tar >socat.
tar.bz2
164 VERSION
= `sed 's/"//g' VERSION`
165 TARDIR
= socat-
$(VERSION
)
166 socat.
tar: configure.in configure Makefile.in config.h.in install-sh VERSION
$(CFILES
) $(HFILES
) $(DOCFILES
) $(SHFILES
) $(TESTFILES
) socat.spec \
168 if
[ ! -d
$(TARDIR
) ]; then mkdir
$(TARDIR
); fi
169 tar cf
- $+ |
(cd
$(TARDIR
); tar xf
-)
170 tar cvf socat.
tar $(TARDIR
)
171 rm -f
$(TARDIR
)/COPYING
# write protected
175 rm -f
*.o libxio.a socat procan filan \
176 socat.
tar socat.
tar.Z socat.
tar.gz socat.
tar.bz2 \
177 socat.out compile.log
test.log
179 # remove all files that are generated from the original socat distribution
180 # note that Makefile is also removed, so you have to start with ./configure
183 rm -f config.status config.cache config.log config.h Makefile
184 rm -rf autom4te.cache
188 .
/socat
-V
>>socat.out
189 .
/socat
-hh
>>socat.out
191 # perform some tests on socat
196 # prepare critical files with correct permissions to avoid race cond
199 chmod
600 cert.key cert.pem
200 # generate a private key
201 openssl genrsa
-out cert.key
1024
202 # generate a self signed cert
203 openssl req
-new
-key cert.key
-x509
-days
3653 -out cert.crt
205 # generate the pem file
206 cat cert.key cert.crt
>cert.pem
207 #echo use cert.pem on requestors side, i.e. with option cert=cert.pem
208 #echo use cert.crt on checkers side, i.e. with option cafile=cert.crt