11
12
# __BSD_VISIBLE is for FreeBSD AF_* constants
12
13
# _ALL_SOURCE is for AIX 5.3 LOG_PERROR constant
15
OBJS=utils.o ntlm.o xcrypt.o config.o socket.o acl.o auth.o http.o proxy.o
16
CFLAGS=$(FLAGS) -std=c99 -Wall -pedantic -O3 -D__BSD_VISIBLE -D_ALL_SOURCE -D_XOPEN_SOURCE=600 -D_POSIX_C_SOURCE=200112 -D_ISOC99_SOURCE -D_REENTRANT -DVERSION=\"`cat VERSION`\"
18
OBJS=utils.o ntlm.o xcrypt.o config.o socket.o acl.o auth.o http.o forward.o direct.o scanner.o pages.o main.o
19
CFLAGS=$(FLAGS) -std=c99 -Wall -pedantic -O3 -D__BSD_VISIBLE -D_ALL_SOURCE -D_XOPEN_SOURCE=600 -D_POSIX_C_SOURCE=200112 -D_ISOC99_SOURCE -D_REENTRANT -DVERSION=\"`cat VERSION`\" -g
21
OSLDFLAGS=$(shell [ $(OS) = "SunOS" ] && echo "-lrt -lsocket -lnsl")
22
LDFLAGS:=-lpthread $(OSLDFLAGS)
22
24
$(NAME): configure-stamp $(OBJS)
24
26
@$(CC) $(CFLAGS) -o $@ $(OBJS) $(LDFLAGS)
27
29
@echo "Compiling $<"
28
30
@if [ -z "$(SYSCONFDIR)" ]; then \
29
$(CC) $(CFLAGS) -c proxy.c -o $@; \
31
$(CC) $(CFLAGS) -c main.c -o $@; \
31
$(CC) $(CFLAGS) -DSYSCONFDIR=\"$(SYSCONFDIR)\" -c proxy.c -o $@; \
33
$(CC) $(CFLAGS) -DSYSCONFDIR=\"$(SYSCONFDIR)\" -c main.c -o $@; \
40
42
if [ -f /usr/bin/oslevel ]; then \
41
install -O root -G system -M 755 -S -f $(BINDIR) $(NAME); \
42
install -O root -G system -M 644 -f $(MANDIR)/man1 doc/$(NAME).1; \
43
install -O root -G system -M 600 -c $(SYSCONFDIR) doc/$(NAME).conf; \
43
install -M 755 -S -f $(BINDIR) $(NAME); \
44
install -M 644 -f $(MANDIR)/man1 doc/$(NAME).1; \
45
install -M 600 -c $(SYSCONFDIR) doc/$(NAME).conf; \
45
install -D -o root -g root -m 755 -s $(NAME) $(BINDIR)/$(NAME); \
46
install -D -o root -g root -m 644 doc/$(NAME).1 $(MANDIR)/man1/$(NAME).1; \
47
install -D -m 755 -s $(NAME) $(BINDIR)/$(NAME); \
48
install -D -m 644 doc/$(NAME).1 $(MANDIR)/man1/$(NAME).1; \
47
49
[ -f $(SYSCONFDIR)/$(NAME).conf -o -z "$(SYSCONFDIR)" ] \
48
|| install -D -o root -g root -m 600 doc/$(NAME).conf $(SYSCONFDIR)/$(NAME).conf; \
50
|| install -D -m 600 doc/$(NAME).conf $(SYSCONFDIR)/$(NAME).conf; \
50
52
@echo; echo "Cntlm will look for configuration in $(SYSCONFDIR)/$(NAME).conf"
53
if [ `id -u` = 0 ]; then \
54
redhat/rules binary; \
57
fakeroot redhat/rules binary; \
58
fakeroot redhat/rules clean; \
63
rm -f tmp/$(NAME)-$(VER)
64
ln -s $(DIR) tmp/$(NAME)-$(VER)
65
sed "s/^\./$(NAME)-$(VER)/" doc/files.txt | tar zchf $(NAME)-$(VER).tar.gz --no-recursion -C tmp -T -
67
rmdir tmp 2>/dev/null || true
70
groff -t -e -mandoc -Tps doc/cntlm.1 | ps2pdf - win32/cntlm_manual.pdf
71
cat doc/cntlm.conf | unix2dos > win32/cntlm.ini
72
cp /bin/cygwin1.dll /bin/cygrunsrv.exe win32/
76
ln -s win32 cntlm-install
77
zip -r cntlm-$(VER)-win32.zip cntlm-install -x *.svn/*
78
rm -f cntlm-install cntlm-$(VER)-win32.zip.sig
56
rm -rf tmp/$(NAME)-$(VER)
57
svn export . tmp/$(NAME)-$(VER)
58
tar zcvf $(NAME)-$(VER).tar.gz -C tmp/ $(NAME)-$(VER)
59
rm -rf tmp/$(NAME)-$(VER)
60
rmdir tmp 2>/dev/null || true
64
rm -rf tmp/$(NAME)-$(VER)
65
svn export . tmp/$(NAME)-$(VER)
66
tar jcvf $(NAME)-$(VER).tar.bz2 -C tmp/ $(NAME)-$(VER)
67
rm -rf tmp/$(NAME)-$(VER)
68
rmdir tmp 2>/dev/null || true
72
sed -i "s/^\(cntlm *\)([^)]*)/\1($(VER))/g" debian/changelog
73
if [ `id -u` = 0 ]; then \
74
debian/rules binary; \
77
fakeroot debian/rules binary; \
78
fakeroot debian/rules clean; \
80
mv ../cntlm_$(VER)*.deb .
84
sed -i "s/^\(Version:[\t ]*\)\(.*\)/\1$(VER)/g" rpm/cntlm.spec
85
if [ `id -u` = 0 ]; then \
89
fakeroot rpm/rules binary; \
90
fakeroot rpm/rules clean; \
96
@echo "* This build target must be run from a Cywgin shell on Windows *"
97
@echo "* and you also need InnoSetup installed *"
99
rm -f win/cntlm_manual.pdf
100
groff -t -e -mandoc -Tps doc/cntlm.1 | ps2pdf - win/cntlm_manual.pdf
101
cat doc/cntlm.conf | unix2dos > win/cntlm.ini
102
cat COPYRIGHT LICENSE | unix2dos > win/license.txt
103
sed "s/\$$VERSION/$(VER)/g" win/setup.iss.in > win/setup.iss
104
cp /bin/cygwin1.dll /bin/cygrunsrv.exe win/
108
@echo Now open folder "win", right-click "setup.iss", then "Compile".
109
@echo InnoSetup will generate a new installer cntlm-X.XX-setup.exe
81
113
rm -f $(BINDIR)/$(NAME) $(MANDIR)/man1/$(NAME).1 2>/dev/null || true
84
116
@rm -f *.o cntlm cntlm.exe configure-stamp build-stamp config/config.h 2>/dev/null
85
@rm -f cntlm-install win32/cyg* win32/cntlm* 2>/dev/null
117
@rm -f win/*.exe win/*.dll win/*.iss win/*.pdf win/cntlm.ini win/license.txt 2>/dev/null
86
118
@rm -f config/endian config/gethostname config/strdup config/socklen_t config/*.exe
87
119
@if [ -h Makefile ]; then rm -f Makefile; mv Makefile.gcc Makefile; fi
90
@rm -f *.deb *.tgz *.tar.gz *.rpm *.o tags cntlm pid massif* callgrind* 2>/dev/null
93
122
if [ `id -u` = 0 ]; then \
123
debian/rules clean; \
96
fakeroot redhat/rules clean; \
126
fakeroot debian/rules clean; \
127
fakeroot rpm/rules clean; \
129
@rm -f *.exe *.deb *.rpm *.tgz *.tar.gz *.tar.bz2 tags ctags pid 2>/dev/null