~ubuntu-branches/ubuntu/trusty/cntlm/trusty

« back to all changes in this revision

Viewing changes to Makefile

  • Committer: Bazaar Package Importer
  • Author(s): Stefano Rivera
  • Date: 2010-09-28 18:05:06 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20100928180506-gtyapggs7it9v9dn
Tags: 0.91~rc6-0ubuntu1
New Upstream pre-release (LP: #649171)

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
# You can tweak these three variables to make things install where you
3
3
# like, but do not touch more unless you know what you are doing. ;)
4
4
#
 
5
DESTDIR=
5
6
SYSCONFDIR=$(DESTDIR)/etc
6
7
BINDIR=$(DESTDIR)/usr/sbin
7
8
MANDIR=$(DESTDIR)/usr/share/man
11
12
# __BSD_VISIBLE is for FreeBSD AF_* constants
12
13
# _ALL_SOURCE is for AIX 5.3 LOG_PERROR constant
13
14
#
 
15
NAME=cntlm
14
16
CC=gcc
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`\"
17
 
LDFLAGS=-lpthread
18
 
NAME=cntlm
19
17
VER=`cat VERSION`
20
 
DIR=`pwd`
 
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
 
20
OS=$(shell uname -s)
 
21
OSLDFLAGS=$(shell [ $(OS) = "SunOS" ] && echo "-lrt -lsocket -lnsl")
 
22
LDFLAGS:=-lpthread $(OSLDFLAGS)
21
23
 
22
24
$(NAME): configure-stamp $(OBJS)
23
25
        @echo "Linking $@"
24
26
        @$(CC) $(CFLAGS) -o $@ $(OBJS) $(LDFLAGS)
25
27
 
26
 
proxy.o: proxy.c
 
28
main.o: main.c
27
29
        @echo "Compiling $<"
28
30
        @if [ -z "$(SYSCONFDIR)" ]; then \
29
 
                $(CC) $(CFLAGS) -c proxy.c -o $@; \
 
31
                $(CC) $(CFLAGS) -c main.c -o $@; \
30
32
        else \
31
 
                $(CC) $(CFLAGS) -DSYSCONFDIR=\"$(SYSCONFDIR)\" -c proxy.c -o $@; \
 
33
                $(CC) $(CFLAGS) -DSYSCONFDIR=\"$(SYSCONFDIR)\" -c main.c -o $@; \
32
34
        fi
33
35
 
34
36
.c.o:
38
40
install: $(NAME)
39
41
        # AIX?
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; \
44
46
        else \
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; \
49
51
        fi
50
52
        @echo; echo "Cntlm will look for configuration in $(SYSCONFDIR)/$(NAME).conf"
51
53
 
52
 
rpm:
53
 
        if [ `id -u` = 0 ]; then \
54
 
                redhat/rules binary; \
55
 
                redhat/rules clean; \
56
 
        else \
57
 
                fakeroot redhat/rules binary; \
58
 
                fakeroot redhat/rules clean; \
59
 
        fi
60
 
 
61
54
tgz:
62
55
        mkdir -p tmp
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 -
66
 
        rm tmp/$(NAME)-$(VER)
67
 
        rmdir tmp 2>/dev/null || true
68
 
 
69
 
win:
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/
73
 
        strip cntlm.exe
74
 
        cp cntlm.exe win32/
75
 
        rm -f cntlm-install
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
 
61
 
 
62
tbz2:
 
63
        mkdir -p tmp
 
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
 
69
 
 
70
deb: builddeb
 
71
builddeb:
 
72
        sed -i "s/^\(cntlm *\)([^)]*)/\1($(VER))/g" debian/changelog
 
73
        if [ `id -u` = 0 ]; then \
 
74
                debian/rules binary; \
 
75
                debian/rules clean; \
 
76
        else \
 
77
                fakeroot debian/rules binary; \
 
78
                fakeroot debian/rules clean; \
 
79
        fi
 
80
        mv ../cntlm_$(VER)*.deb .
 
81
 
 
82
rpm: buildrpm
 
83
buildrpm:
 
84
        sed -i "s/^\(Version:[\t ]*\)\(.*\)/\1$(VER)/g" rpm/cntlm.spec
 
85
        if [ `id -u` = 0 ]; then \
 
86
                rpm/rules binary; \
 
87
                rpm/rules clean; \
 
88
        else \
 
89
                fakeroot rpm/rules binary; \
 
90
                fakeroot rpm/rules clean; \
 
91
        fi
 
92
 
 
93
win: buildwin
 
94
buildwin:
 
95
        @echo
 
96
        @echo "* This build target must be run from a Cywgin shell on Windows *"
 
97
        @echo "* and you also need InnoSetup installed                        *"
 
98
        @echo
 
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/
 
105
        cp cntlm.exe win/
 
106
        strip win/cntlm.exe
 
107
        @echo
 
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
 
110
        @echo
79
111
 
80
112
uninstall:
81
113
        rm -f $(BINDIR)/$(NAME) $(MANDIR)/man1/$(NAME).1 2>/dev/null || true
82
114
 
83
115
clean:
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
88
120
 
89
 
cleanp: clean
90
 
        @rm -f *.deb *.tgz *.tar.gz *.rpm *.o tags cntlm pid massif* callgrind* 2>/dev/null
91
 
 
92
121
distclean: clean
93
122
        if [ `id -u` = 0 ]; then \
94
 
                redhat/rules clean; \
 
123
                debian/rules clean; \
 
124
                rpm/rules clean; \
95
125
        else \
96
 
                fakeroot redhat/rules clean; \
 
126
                fakeroot debian/rules clean; \
 
127
                fakeroot rpm/rules clean; \
97
128
        fi
98
 
 
 
129
        @rm -f *.exe *.deb *.rpm *.tgz *.tar.gz *.tar.bz2 tags ctags pid 2>/dev/null