2 # You can tweak these three variables to make things install where you
3 # like, but do not touch more unless you know what you are doing. ;)
6 SYSCONFDIR
=$(DESTDIR
)/etc
7 BINDIR
=$(DESTDIR
)/usr
/sbin
8 MANDIR
=$(DESTDIR
)/usr
/share
/man
12 # __BSD_VISIBLE is for FreeBSD AF_* constants
13 # _ALL_SOURCE is for AIX 5.3 LOG_PERROR constant
18 CFLAGS
+=$(FLAGS
) -std
=c99
-Wall
-Wno-unused-but-set-variable
-pedantic
-O3
-D__BSD_VISIBLE
-D_ALL_SOURCE
-D_XOPEN_SOURCE
=600 -D_POSIX_C_SOURCE
=200112 -D_ISOC99_SOURCE
-D_REENTRANT
-D_BSD_SOURCE
-DVERSION
=\"`cat VERSION`\"
20 OSLDFLAGS
=$(shell [ $(OS
) = "SunOS" ] && echo
"-lrt -lsocket -lnsl")
21 LDFLAGS
:=-lpthread
$(OSLDFLAGS
)
23 ifeq ($(findstring CYGWIN
,$(OS
)),)
24 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
26 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 win
/resources.o
29 $(NAME
): configure-stamp
$(OBJS
)
31 @
$(CC
) $(CFLAGS
) -o
$@
$(OBJS
) $(LDFLAGS
)
35 @if
[ -z
"$(SYSCONFDIR)" ]; then \
36 $(CC
) $(CFLAGS
) -c main.c
-o
$@
; \
38 $(CC
) $(CFLAGS
) -DSYSCONFDIR
=\"$(SYSCONFDIR
)\" -c main.c
-o
$@
; \
43 @
$(CC
) $(CFLAGS
) -c
-o
$@
$<
46 # Special handling for install(1)
47 if
[ "`uname -s`" = "AIX" ]; then \
48 install -M
755 -S
-f
$(BINDIR
) $(NAME
); \
49 install -M
644 -f
$(MANDIR
)/man1 doc
/$(NAME
).1; \
50 install -M
600 -c
$(SYSCONFDIR
) doc
/$(NAME
).conf
; \
51 elif
[ "`uname -s`" = "Darwin" ]; then \
52 install -d
-m
755 -s
$(NAME
) $(BINDIR
)/$(NAME
); \
53 install -d
-m
644 doc
/$(NAME
).1 $(MANDIR
)/man1
/$(NAME
).1; \
54 [ -f
$(SYSCONFDIR
)/$(NAME
).conf
-o
-z
"$(SYSCONFDIR)" ] \
55 ||
install -d
-m
600 doc
/$(NAME
).conf
$(SYSCONFDIR
)/$(NAME
).conf
; \
57 install -D
-m
755 -s
$(NAME
) $(BINDIR
)/$(NAME
); \
58 install -D
-m
644 doc
/$(NAME
).1 $(MANDIR
)/man1
/$(NAME
).1; \
59 [ -f
$(SYSCONFDIR
)/$(NAME
).conf
-o
-z
"$(SYSCONFDIR)" ] \
60 ||
install -D
-m
600 doc
/$(NAME
).conf
$(SYSCONFDIR
)/$(NAME
).conf
; \
62 @echo
; echo
"Cntlm will look for configuration in $(SYSCONFDIR)/$(NAME).conf"
66 rm -rf tmp
/$(NAME
)-$(VER
)
67 svn
export . tmp
/$(NAME
)-$(VER
)
68 tar zcvf
$(NAME
)-$(VER
).
tar.gz
-C tmp
/ $(NAME
)-$(VER
)
69 rm -rf tmp
/$(NAME
)-$(VER
)
70 rmdir tmp
2>/dev
/null || true
74 rm -rf tmp
/$(NAME
)-$(VER
)
75 svn
export . tmp
/$(NAME
)-$(VER
)
76 tar jcvf
$(NAME
)-$(VER
).
tar.bz2
-C tmp
/ $(NAME
)-$(VER
)
77 rm -rf tmp
/$(NAME
)-$(VER
)
78 rmdir tmp
2>/dev
/null || true
82 sed
-i
"s/^\(cntlm *\)([^)]*)/\1($(VER))/g" debian
/changelog
83 if
[ `id -u` = 0 ]; then \
84 debian
/rules binary
; \
87 fakeroot debian
/rules binary
; \
88 fakeroot debian
/rules
clean; \
90 mv ..
/cntlm_
$(VER
)*.deb .
94 sed
-i
"s/^\(Version:[\t ]*\)\(.*\)/\1$(VER)/g" rpm
/cntlm.spec
95 if
[ `id -u` = 0 ]; then \
99 fakeroot rpm
/rules binary
; \
100 fakeroot rpm
/rules
clean; \
106 @echo
"* This build target must be run from a Cywgin shell on Windows *"
107 @echo
"* and you also need InnoSetup installed *"
109 rm -f win
/cntlm_manual.pdf
110 groff
-t
-e
-mandoc
-Tps doc
/cntlm
.1 | ps2pdf
- win
/cntlm_manual.pdf
111 cat doc
/cntlm.conf | unix2dos
> win
/cntlm.ini
112 cat COPYRIGHT LICENSE | unix2dos
> win
/license.txt
113 sed
"s/\$$VERSION/$(VER)/g" win
/setup.iss.in
> win
/setup.iss
114 cp
/bin
/cygwin1.dll
/bin
/cyggcc_s-1.dll
/bin
/cygrunsrv.exe win
/
117 ln
-s win
$(NAME
)-$(VER
)
118 zip
-9 $(NAME
)-$(VER
).zip
$(NAME
)-$(VER
)/cntlm.exe
$(NAME
)-$(VER
)/cyggcc_s-1.dll
$(NAME
)-$(VER
)/cygwin1.dll
$(NAME
)-$(VER
)/cygrunsrv.exe
$(NAME
)-$(VER
)/cntlm.ini
$(NAME
)-$(VER
)/README.txt
$(NAME
)-$(VER
)/license.txt
121 @echo Now open folder
"win", right-click
"setup.iss", then
"Compile".
122 @echo InnoSetup will generate a new installer cntlm-X.XX-setup.exe
125 win
/resources.o
: win
/resources.rc
126 @echo Adding EXE resources
130 rm -f
$(BINDIR
)/$(NAME
) $(MANDIR
)/man1
/$(NAME
).1 2>/dev
/null || true
133 @
rm -f
*.o cntlm cntlm.exe configure-stamp build-stamp config
/config.h
2>/dev
/null
134 @
rm -f win
/*.exe win
/*.dll win
/*.iss win
/*.pdf win
/cntlm.ini win
/license.txt win
/resouces.o
2>/dev
/null
135 @
rm -f config
/endian config
/gethostname config
/strdup config
/socklen_t config
/*.exe
136 @if
[ -h Makefile
]; then
rm -f Makefile
; mv Makefile.gcc Makefile
; fi
139 if
[ `id -u` = 0 ]; then \
140 debian
/rules
clean; \
143 fakeroot debian
/rules
clean; \
144 fakeroot rpm
/rules
clean; \
146 @
rm -f
*.exe
*.deb
*.rpm
*.tgz
*.
tar.gz
*.
tar.bz2
tags ctags pid
2>/dev
/null