/mandos/trunk

To get this branch, use:
bzr branch http://bzr.recompile.se/loggerhead/mandos/trunk

« back to all changes in this revision

Viewing changes to Makefile

  • Committer: Teddy Hogeborn
  • Date: 2008-09-26 21:54:54 UTC
  • Revision ID: teddy@fukt.bsnet.se-20080926215454-7kfrl0gxmisz71gw
* mandos: Remove unused "select" module.  Import "ctypes.util".
  (AvahiError.__init__): Call __init__ of superclass.
  (AvahiService.__init__): Rename keyword arg "type" to "servicetype".
  (AvahiService.rename): Bug fix: use "self.rename_count".
  (Client.__init__): Use "None" instead of "{}" as default value.
  (tcp_handler): Renamed to "TCP_handler".  All callers changed.
  (IPv6_TCPServer.__init__): Don't "return", just call the superclass
                             method.
  (if_nametoindex): Don't import "ctypes.util" here.
  (main): Removed unused variable "main_loop_started".

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
WARN=-O -Wall -Wformat=2 -Winit-self -Wmissing-include-dirs \
2
2
        -Wswitch-default -Wswitch-enum -Wunused-parameter \
3
 
        -Wstrict-aliasing=1 -Wextra -Wfloat-equal -Wundef -Wshadow \
 
3
        -Wstrict-aliasing=2 -Wextra -Wfloat-equal -Wundef -Wshadow \
4
4
        -Wunsafe-loop-optimizations -Wpointer-arith \
5
5
        -Wbad-function-cast -Wcast-qual -Wcast-align -Wwrite-strings \
6
6
        -Wconversion -Wstrict-prototypes -Wold-style-definition \
9
9
#DEBUG=-ggdb3
10
10
# For info about _FORTIFY_SOURCE, see
11
11
# <http://gcc.gnu.org/ml/gcc-patches/2004-09/msg02055.html>
12
 
FORTIFY=-D_FORTIFY_SOURCE=2 -fstack-protector-all -fPIC
13
 
LINK_FORTIFY_LD=-z relro -z now
14
 
LINK_FORTIFY=
15
 
ifndef BROKEN_PIE
16
 
FORTIFY += -fPIE
17
 
LINK_FORTIFY_LD += -fPIE
18
 
LINK_FORTIFY += -pie
19
 
endif
 
12
FORTIFY=-D_FORTIFY_SOURCE=2 # -fstack-protector-all
20
13
#COVERAGE=--coverage
21
14
OPTIMIZE=-Os
22
15
LANGUAGE=-std=gnu99
23
 
htmldir=man
24
 
version=1.0.14
25
 
SED=sed
26
16
 
27
17
## Use these settings for a traditional /usr/local install
28
18
# PREFIX=$(DESTDIR)/usr/local
40
30
INITRAMFSTOOLS=$(DESTDIR)/usr/share/initramfs-tools
41
31
##
42
32
 
43
 
GNUTLS_CFLAGS=$(shell pkg-config --cflags-only-I gnutls)
44
 
GNUTLS_LIBS=$(shell pkg-config --libs gnutls)
 
33
GNUTLS_CFLAGS=$(shell libgnutls-config --cflags)
 
34
GNUTLS_LIBS=$(shell libgnutls-config --libs)
45
35
AVAHI_CFLAGS=$(shell pkg-config --cflags-only-I avahi-core)
46
36
AVAHI_LIBS=$(shell pkg-config --libs avahi-core)
47
 
GPGME_CFLAGS=$(shell gpgme-config --cflags; getconf LFS_CFLAGS)
48
 
GPGME_LIBS=$(shell gpgme-config --libs; getconf LFS_LIBS; \
49
 
        getconf LFS_LDFLAGS)
 
37
GPGME_CFLAGS=$(shell gpgme-config --cflags)
 
38
GPGME_LIBS=$(shell gpgme-config --libs)
50
39
 
51
40
# Do not change these two
52
41
CFLAGS=$(WARN) $(DEBUG) $(FORTIFY) $(COVERAGE) $(OPTIMIZE) \
53
 
        $(LANGUAGE) $(GNUTLS_CFLAGS) $(AVAHI_CFLAGS) $(GPGME_CFLAGS) \
54
 
        -DVERSION='"$(version)"'
55
 
LDFLAGS=$(COVERAGE) $(LINK_FORTIFY) $(foreach flag,$(LINK_FORTIFY_LD),-Xlinker $(flag))
 
42
        $(LANGUAGE) $(GNUTLS_CFLAGS) $(AVAHI_CFLAGS) $(GPGME_CFLAGS)
 
43
LDFLAGS=$(COVERAGE)
56
44
 
57
45
# Commands to format a DocBook <refentry> document into a manual page
58
46
DOCBOOKTOMAN=cd $(dir $<); xsltproc --nonet --xinclude \
65
53
        $(notdir $<); \
66
54
        $(MANPOST) $(notdir $@)
67
55
# DocBook-to-man post-processing to fix a '\n' escape bug
68
 
MANPOST=$(SED) --in-place --expression='s,\\\\en,\\en,g;s,\\n,\\en,g'
69
 
 
70
 
DOCBOOKTOHTML=xsltproc --nonet --xinclude \
71
 
        --param make.year.ranges                1 \
72
 
        --param make.single.year.ranges         1 \
73
 
        --param man.output.quietly              1 \
74
 
        --param man.authors.section.enabled     0 \
75
 
        --param citerefentry.link               1 \
76
 
        --output $@ \
77
 
        /usr/share/xml/docbook/stylesheet/nwalsh/xhtml/docbook.xsl \
78
 
        $<; $(HTMLPOST) $@
79
 
# Fix citerefentry links
80
 
HTMLPOST=$(SED) --in-place \
81
 
        --expression='s/\(<a class="citerefentry" href="\)\("><span class="citerefentry"><span class="refentrytitle">\)\([^<]*\)\(<\/span>(\)\([^)]*\)\()<\/span><\/a>\)/\1\3.\5\2\3\4\5\6/g'
 
56
MANPOST=sed --in-place --expression='s,\\\\en,\\en,g;s,\\n,\\en,g'
82
57
 
83
58
PLUGINS=plugins.d/password-prompt plugins.d/mandos-client \
84
59
        plugins.d/usplash plugins.d/splashy plugins.d/askpass-fifo
85
 
CPROGS=plugin-runner $(PLUGINS)
86
 
PROGS=mandos mandos-keygen mandos-ctl $(CPROGS)
 
60
PROGS=plugin-runner $(PLUGINS)
87
61
DOCS=mandos.8 plugin-runner.8mandos mandos-keygen.8 \
88
62
        plugins.d/mandos-client.8mandos \
89
63
        plugins.d/password-prompt.8mandos mandos.conf.5 \
90
 
        plugins.d/usplash.8mandos plugins.d/splashy.8mandos \
91
 
        plugins.d/askpass-fifo.8mandos mandos-clients.conf.5
92
 
 
93
 
htmldocs=$(addsuffix .xhtml,$(DOCS))
94
 
 
95
 
objects=$(addsuffix .o,$(CPROGS))
96
 
 
97
 
all: $(PROGS) mandos.lsm
 
64
        mandos-clients.conf.5
 
65
 
 
66
objects=$(addsuffix .o,$(PROGS))
 
67
 
 
68
all: $(PROGS)
98
69
 
99
70
doc: $(DOCS)
100
71
 
101
 
html: $(htmldocs)
102
 
 
103
 
%.5: %.xml common.ent legalnotice.xml
104
 
        $(DOCBOOKTOMAN)
105
 
%.5.xhtml: %.xml common.ent legalnotice.xml
106
 
        $(DOCBOOKTOHTML)
107
 
 
108
 
%.8: %.xml common.ent legalnotice.xml
109
 
        $(DOCBOOKTOMAN)
110
 
%.8.xhtml: %.xml common.ent legalnotice.xml
111
 
        $(DOCBOOKTOHTML)
112
 
 
113
 
%.8mandos: %.xml common.ent legalnotice.xml
114
 
        $(DOCBOOKTOMAN)
115
 
%.8mandos.xhtml: %.xml common.ent legalnotice.xml
116
 
        $(DOCBOOKTOHTML)
117
 
 
118
 
mandos.8: mandos.xml common.ent mandos-options.xml overview.xml \
119
 
                legalnotice.xml
120
 
        $(DOCBOOKTOMAN)
121
 
mandos.8.xhtml: mandos.xml common.ent mandos-options.xml \
122
 
                overview.xml legalnotice.xml
123
 
        $(DOCBOOKTOHTML)
124
 
 
125
 
mandos-keygen.8: mandos-keygen.xml common.ent overview.xml \
126
 
                legalnotice.xml
127
 
        $(DOCBOOKTOMAN)
128
 
mandos-keygen.8.xhtml: mandos-keygen.xml common.ent overview.xml \
129
 
                 legalnotice.xml
130
 
        $(DOCBOOKTOHTML)
131
 
 
132
 
mandos.conf.5: mandos.conf.xml common.ent mandos-options.xml \
133
 
                legalnotice.xml
134
 
        $(DOCBOOKTOMAN)
135
 
mandos.conf.5.xhtml: mandos.conf.xml common.ent mandos-options.xml \
136
 
                legalnotice.xml
137
 
        $(DOCBOOKTOHTML)
138
 
 
139
 
plugin-runner.8mandos: plugin-runner.xml common.ent overview.xml \
140
 
                legalnotice.xml
141
 
        $(DOCBOOKTOMAN)
142
 
plugin-runner.8mandos.xhtml: plugin-runner.xml common.ent \
143
 
                overview.xml legalnotice.xml
144
 
        $(DOCBOOKTOHTML)
 
72
%.5: %.xml legalnotice.xml
 
73
        $(DOCBOOKTOMAN)
 
74
 
 
75
%.8: %.xml legalnotice.xml
 
76
        $(DOCBOOKTOMAN)
 
77
 
 
78
%.8mandos: %.xml legalnotice.xml
 
79
        $(DOCBOOKTOMAN)
 
80
 
 
81
mandos.8: mandos.xml mandos-options.xml overview.xml legalnotice.xml
 
82
        $(DOCBOOKTOMAN)
 
83
 
 
84
mandos-keygen.8: mandos-keygen.xml overview.xml legalnotice.xml
 
85
        $(DOCBOOKTOMAN)
 
86
 
 
87
mandos.conf.5: mandos.conf.xml mandos-options.xml legalnotice.xml
 
88
        $(DOCBOOKTOMAN)
 
89
 
 
90
plugin-runner.8mandos: plugin-runner.xml overview.xml legalnotice.xml
 
91
        $(DOCBOOKTOMAN)
145
92
 
146
93
plugins.d/mandos-client.8mandos: plugins.d/mandos-client.xml \
147
 
                                        common.ent \
148
94
                                        mandos-options.xml \
149
95
                                        overview.xml legalnotice.xml
150
96
        $(DOCBOOKTOMAN)
151
 
plugins.d/mandos-client.8mandos.xhtml: plugins.d/mandos-client.xml \
152
 
                                        common.ent \
153
 
                                        mandos-options.xml \
154
 
                                        overview.xml legalnotice.xml
155
 
        $(DOCBOOKTOHTML)
156
 
 
157
 
# Update all these files with version number $(version)
158
 
common.ent: Makefile
159
 
        $(SED) --in-place \
160
 
                --expression='s/^\(<!ENTITY version "\)[^"]*">$$/\1$(version)">/' \
161
 
                $@
162
 
 
163
 
mandos: Makefile
164
 
        $(SED) --in-place \
165
 
                --expression='s/^\(version = "\)[^"]*"$$/\1$(version)"/' \
166
 
                $@
167
 
 
168
 
mandos-keygen: Makefile
169
 
        $(SED) --in-place \
170
 
                --expression='s/^\(VERSION="\)[^"]*"$$/\1$(version)"/' \
171
 
                $@
172
 
 
173
 
mandos-ctl: Makefile
174
 
        $(SED) --in-place \
175
 
                --expression='s/^\(version = "\)[^"]*"$$/\1$(version)"/' \
176
 
                $@
177
 
 
178
 
mandos.lsm: Makefile
179
 
        $(SED) --in-place \
180
 
                --expression='s/^\(Version:\).*/\1\t$(version)/' \
181
 
                $@
182
 
        $(SED) --in-place \
183
 
                --expression='s/^\(Entered-date:\).*/\1\t$(shell date --rfc-3339=date --reference=Makefile)/' \
184
 
                $@
185
 
        $(SED) --in-place \
186
 
                --expression='s/\(mandos_\)[0-9.]\+\(\.orig\.tar\.gz\)/\1$(version)\2/' \
187
 
                $@
188
97
 
189
98
plugins.d/mandos-client: plugins.d/mandos-client.o
190
99
        $(LINK.o) $(GNUTLS_LIBS) $(AVAHI_LIBS) $(GPGME_LIBS) \
191
100
                $(COMMON) $^ $(LOADLIBES) $(LDLIBS) -o $@
192
101
 
193
 
.PHONY : all doc html clean distclean run-client run-server install \
 
102
.PHONY : all doc clean distclean run-client run-server install \
194
103
        install-server install-client uninstall uninstall-server \
195
104
        uninstall-client purge purge-server purge-client
196
105
 
197
106
clean:
198
 
        -rm --force $(CPROGS) $(objects) $(htmldocs) $(DOCS) core
 
107
        -rm --force $(PROGS) $(objects) $(DOCS) core
199
108
 
200
109
distclean: clean
201
110
mostlyclean: clean
202
111
maintainer-clean: clean
203
112
        -rm --force --recursive keydir confdir
204
113
 
205
 
check:  all
 
114
check:
206
115
        ./mandos --check
207
116
 
208
117
# Run the client with a local config and key
209
118
run-client: all keydir/seckey.txt keydir/pubkey.txt
210
 
        @echo "###################################################################"
211
 
        @echo "# The following error messages are harmless and can be safely     #"
212
 
        @echo "# ignored.  The messages are caused by not running as root, but   #"
213
 
        @echo "# you should NOT run \"make run-client\" as root unless you also    #"
214
 
        @echo "# unpacked and compiled Mandos as root, which is NOT recommended. #"
215
 
        @echo "# From plugin-runner: setuid: Operation not permitted             #"
216
 
        @echo "# From askpass-fifo:  mkfifo: Permission denied                   #"
217
 
        @echo "# From mandos-client: setuid: Operation not permitted             #"
218
 
        @echo "#                     seteuid: Operation not permitted            #"
219
 
        @echo "#                     klogctl: Operation not permitted            #"
220
 
        @echo "###################################################################"
221
119
        ./plugin-runner --plugin-dir=plugins.d \
222
120
                --config-file=plugin-runner.conf \
223
 
                --options-for=mandos-client:--seckey=keydir/seckey.txt,--pubkey=keydir/pubkey.txt \
224
 
                $(CLIENTARGS)
 
121
                --options-for=mandos-client:--seckey=keydir/seckey.txt,--pubkey=keydir/pubkey.txt
225
122
 
226
123
# Used by run-client
227
124
keydir/seckey.txt keydir/pubkey.txt: mandos-keygen
230
127
 
231
128
# Run the server with a local config
232
129
run-server: confdir/mandos.conf confdir/clients.conf
233
 
        @echo "#################################################################"
234
 
        @echo "# NOTE: Please IGNORE errors about \"No permission to bind to    #"
235
 
        @echo "# interface\" or \"Could not open file u'/var/run/mandos.pid'\" -  #"
236
 
        @echo "# they are harmless and are caused by the server not running as #"
237
 
        @echo "# root.  Do NOT run \"make run-server\" server as root if you did #"
238
 
        @echo "# not also unpack and compile it as root.                       #"
239
 
        @echo "#################################################################"
240
 
        ./mandos --debug --no-dbus --configdir=confdir $(SERVERARGS)
 
130
        ./mandos --debug --configdir=confdir
241
131
 
242
132
# Used by run-server
243
133
confdir/mandos.conf: mandos.conf
251
141
 
252
142
install: install-server install-client-nokey
253
143
 
254
 
install-html: html
255
 
        install --directory $(htmldir)
256
 
        install --mode=u=rw,go=r --target-directory=$(htmldir) \
257
 
                $(htmldocs)
258
 
 
259
144
install-server: doc
260
145
        install --directory $(CONFDIR)
261
146
        install --mode=u=rwx,go=rx mandos $(PREFIX)/sbin/mandos
309
194
        install --mode=u=rw,go=r initramfs-tools-hook-conf \
310
195
                $(INITRAMFSTOOLS)/conf-hooks.d/mandos
311
196
        install initramfs-tools-script \
312
 
                $(INITRAMFSTOOLS)/scripts/init-premount/mandos
 
197
                $(INITRAMFSTOOLS)/scripts/local-top/mandos
313
198
        install --mode=u=rw,go=r plugin-runner.conf $(CONFDIR)
314
199
        gzip --best --to-stdout mandos-keygen.8 \
315
200
                > $(MANDIR)/man8/mandos-keygen.8.gz
319
204
                > $(MANDIR)/man8/password-prompt.8mandos.gz
320
205
        gzip --best --to-stdout plugins.d/mandos-client.8mandos \
321
206
                > $(MANDIR)/man8/mandos-client.8mandos.gz
322
 
        gzip --best --to-stdout plugins.d/usplash.8mandos \
323
 
                > $(MANDIR)/man8/usplash.8mandos.gz
324
 
        gzip --best --to-stdout plugins.d/splashy.8mandos \
325
 
                > $(MANDIR)/man8/splashy.8mandos.gz
326
 
        gzip --best --to-stdout plugins.d/askpass-fifo.8mandos \
327
 
                > $(MANDIR)/man8/askpass-fifo.8mandos.gz
328
207
 
329
208
install-client: install-client-nokey
330
209
# Post-installation stuff
353
232
                $(PREFIX)/lib/mandos/plugins.d/mandos-client \
354
233
                $(PREFIX)/lib/mandos/plugins.d/usplash \
355
234
                $(PREFIX)/lib/mandos/plugins.d/splashy \
356
 
                $(PREFIX)/lib/mandos/plugins.d/askpass-fifo \
357
235
                $(INITRAMFSTOOLS)/hooks/mandos \
358
236
                $(INITRAMFSTOOLS)/conf-hooks.d/mandos \
359
 
                $(INITRAMFSTOOLS)/scripts/init-premount/mandos \
 
237
                $(INITRAMFSTOOLS)/scripts/local-top/mandos \
360
238
                $(MANDIR)/man8/plugin-runner.8mandos.gz \
361
239
                $(MANDIR)/man8/mandos-keygen.8.gz \
362
240
                $(MANDIR)/man8/password-prompt.8mandos.gz \
363
 
                $(MANDIR)/man8/usplash.8mandos.gz \
364
 
                $(MANDIR)/man8/splashy.8mandos.gz \
365
 
                $(MANDIR)/man8/askpass-fifo.8mandos.gz \
366
241
                $(MANDIR)/man8/mandos-client.8mandos.gz
 
242
        if [ "$(CONFDIR)" != "$(PREFIX)/lib/mandos" ]; then \
 
243
                rm --force $(CONFDIR)/plugins.d/README; \
 
244
        fi
367
245
        -rmdir $(PREFIX)/lib/mandos/plugins.d $(CONFDIR)/plugins.d \
368
246
                 $(PREFIX)/lib/mandos $(CONFDIR) $(KEYDIR)
369
247
        update-initramfs -k all -u