Makefile.in 9.62 KB
Newer Older
netblue30's avatar
netblue30 committed
1
all: apps man filters
netblue30's avatar
netblue30 committed
2
MYLIBS = src/lib
3
APPS = src/firejail src/firemon src/firecfg src/libtrace src/libtracelog src/ftee src/faudit src/fnet src/fseccomp src/fcopy
netblue30's avatar
netblue30 committed
4
MANPAGES = firejail.1 firemon.1 firecfg.1 firejail-profile.5 firejail-login.5
netblue30's avatar
netblue30 committed
5
SECCOMP_FILTERS = seccomp seccomp.i386 seccomp.amd64
netblue30's avatar
netblue30 committed
6 7

prefix=@prefix@
8 9 10 11 12
exec_prefix=@exec_prefix@
bindir=@bindir@
libdir=@libdir@
datarootdir=@datarootdir@
mandir=@mandir@
netblue30's avatar
netblue30 committed
13
sysconfdir=@sysconfdir@
14

netblue30's avatar
netblue30 committed
15 16 17 18
VERSION=@PACKAGE_VERSION@
NAME=@PACKAGE_NAME@
PACKAGE_TARNAME=@PACKAGE_TARNAME@
DOCDIR=@docdir@
Duncan Overbruck's avatar
Duncan Overbruck committed
19
HAVE_SECCOMP=@HAVE_SECCOMP@
netblue30's avatar
netblue30 committed
20
HAVE_APPARMOR=@HAVE_APPARMOR@
21 22
HAVE_CONTRIB_INSTALL=@HAVE_CONTRIB_INSTALL@
HAVE_GIT_INSTALL=@HAVE_GIT_INSTALL@
23
BUSYBOX_WORKAROUND=@BUSYBOX_WORKAROUND@
netblue30's avatar
netblue30 committed
24

25 26
uids.h:; ./mkuid.sh

netblue30's avatar
netblue30 committed
27
.PHONY: mylibs $(MYLIBS)
28
mylibs: $(MYLIBS) uids.h
netblue30's avatar
netblue30 committed
29 30 31 32 33
$(MYLIBS):
	$(MAKE) -C $@

.PHONY: apps $(APPS)
apps: $(APPS)
34
$(APPS): $(MYLIBS) uids.h
netblue30's avatar
netblue30 committed
35 36
	$(MAKE) -C $@

37 38 39 40
$(MANPAGES): $(wildcard src/man/*.txt)
	./mkman.sh $(VERSION) src/man/$(basename $@).txt $@

man: $(MANPAGES)
netblue30's avatar
netblue30 committed
41

netblue30's avatar
netblue30 committed
42
filters: src/fseccomp
Duncan Overbruck's avatar
Duncan Overbruck committed
43
ifeq ($(HAVE_SECCOMP),-DHAVE_SECCOMP)
netblue30's avatar
netblue30 committed
44 45 46 47
	src/fseccomp/fseccomp default seccomp
	src/fseccomp/fseccomp default seccomp.debug allow-debuggers
	src/fseccomp/fseccomp secondary 32 seccomp.i386
	src/fseccomp/fseccomp secondary 64 seccomp.amd64
Duncan Overbruck's avatar
Duncan Overbruck committed
48
endif
netblue30's avatar
netblue30 committed
49

50
clean:
51
	for dir in $(APPS) $(MYLIBS); do \
netblue30's avatar
netblue30 committed
52 53
		$(MAKE) -C $$dir clean; \
	done
54
	rm -f $(MANPAGES) $(MANPAGES:%=%.gz) firejail*.rpm
netblue30's avatar
netblue30 committed
55
	rm -f seccomp seccomp.debug seccomp.i386 seccomp.amd64
netblue30's avatar
netblue30 committed
56
	rm -f test/utils/index.html*
netblue30's avatar
netblue30 committed
57
	rm -f test/utils/wget-log
netblue30's avatar
netblue30 committed
58
	rm -f test/utils/lstesting
netblue30's avatar
netblue30 committed
59 60 61 62
	rm -f test/environment/index.html*
	rm -f test/environment/wget-log*
	rm -fr test/environment/-testdir
	rm -f test/environment/logfile*
netblue30's avatar
netblue30 committed
63 64
	rm -f test/environment/index.html
	rm -f test/environment/wget-log
netblue30's avatar
netblue30 committed
65
	rm -f test/sysutils/firejail_t*
netblue30's avatar
netblue30 committed
66
	cd test/compile; ./compile.sh --clean; cd ../..
netblue30's avatar
netblue30 committed
67 68

distclean: clean
69
	for dir in $(APPS) $(MYLIBS); do \
netblue30's avatar
netblue30 committed
70 71
		$(MAKE) -C $$dir distclean; \
	done
72
	rm -fr Makefile autom4te.cache config.log config.status config.h uids.h
netblue30's avatar
netblue30 committed
73

74
realinstall:
75
	# firejail executable
netblue30's avatar
netblue30 committed
76
	install -m 0755 -d $(DESTDIR)/$(bindir)
77 78
	install -c -m 0755 src/firejail/firejail $(DESTDIR)/$(bindir)/.
	chmod u+s $(DESTDIR)/$(bindir)/firejail
79
	# firemon executable
80
	install -c -m 0755 src/firemon/firemon $(DESTDIR)/$(bindir)/.
netblue30's avatar
netblue30 committed
81 82
	# firecfg executable
	install -c -m 0755 src/firecfg/firecfg $(DESTDIR)/$(bindir)/.
83
	# libraries and plugins
netblue30's avatar
netblue30 committed
84
	install -m 0755 -d $(DESTDIR)/$(libdir)/firejail
85
	install -c -m 0644 src/libtrace/libtrace.so $(DESTDIR)/$(libdir)/firejail/.
netblue30's avatar
netblue30 committed
86
	install -c -m 0644 src/libtracelog/libtracelog.so $(DESTDIR)/$(libdir)/firejail/.
87 88
	install -c -m 0755 src/ftee/ftee $(DESTDIR)/$(libdir)/firejail/.
	install -c -m 0755 src/fshaper/fshaper.sh $(DESTDIR)/$(libdir)/firejail/.
89
ifeq ($(HAVE_GIT_INSTALL),-DHAVE_GIT_INSTALL)
netblue30's avatar
netblue30 committed
90 91
	install -c -m 0755 src/fgit/fgit-install.sh $(DESTDIR)/$(libdir)/firejail/.
	install -c -m 0755 src/fgit/fgit-uninstall.sh $(DESTDIR)/$(libdir)/firejail/.
92
endif
Duncan Overbruck's avatar
Duncan Overbruck committed
93

netblue30's avatar
netblue30 committed
94
	install -c -m 0644 src/firecfg/firecfg.config $(DESTDIR)/$(libdir)/firejail/.
netblue30's avatar
netblue30 committed
95
	install -c -m 0755 src/faudit/faudit $(DESTDIR)/$(libdir)/firejail/.
netblue30's avatar
netblue30 committed
96
	install -c -m 0755 src/fnet/fnet $(DESTDIR)/$(libdir)/firejail/.
netblue30's avatar
netblue30 committed
97
	install -c -m 0755 src/fcopy/fcopy $(DESTDIR)/$(libdir)/firejail/.
Duncan Overbruck's avatar
Duncan Overbruck committed
98 99
ifeq ($(HAVE_SECCOMP),-DHAVE_SECCOMP)
	install -c -m 0755 src/fseccomp/fseccomp $(DESTDIR)/$(libdir)/firejail/.
netblue30's avatar
netblue30 committed
100 101 102 103
	install -c -m 0644 seccomp $(DESTDIR)/$(libdir)/firejail/.
	install -c -m 0644 seccomp.debug $(DESTDIR)/$(libdir)/firejail/.
	install -c -m 0644 seccomp.i386 $(DESTDIR)/$(libdir)/firejail/.
	install -c -m 0644 seccomp.amd64 $(DESTDIR)/$(libdir)/firejail/.
Duncan Overbruck's avatar
Duncan Overbruck committed
104
endif
netblue30's avatar
netblue30 committed
105
ifeq ($(HAVE_CONTRIB_INSTALL),yes)
netblue30's avatar
netblue30 committed
106 107 108 109
	install -c -m 0755 contrib/fix_private-bin.py $(DESTDIR)/$(libdir)/firejail/.
	install -c -m 0755 contrib/fjclip.py $(DESTDIR)/$(libdir)/firejail/.
	install -c -m 0755 contrib/fjdisplay.py $(DESTDIR)/$(libdir)/firejail/.
	install -c -m 0755 contrib/fjresize.py $(DESTDIR)/$(libdir)/firejail/.
110
	install -c -m 0755 contrib/fj-mkdeb.py $(DESTDIR)/$(libdir)/firejail/.
111
endif
112
	# documents
netblue30's avatar
netblue30 committed
113
	install -m 0755 -d $(DESTDIR)/$(DOCDIR)
114 115 116 117
	install -c -m 0644 COPYING $(DESTDIR)/$(DOCDIR)/.
	install -c -m 0644 README $(DESTDIR)/$(DOCDIR)/.
	install -c -m 0644 RELNOTES $(DESTDIR)/$(DOCDIR)/.
	# etc files
118
	./mketc.sh $(sysconfdir) $(BUSYBOX_WORKAROUND)
netblue30's avatar
netblue30 committed
119
	install -m 0755 -d $(DESTDIR)/$(sysconfdir)/firejail
120 121 122
	for file in .etc/* etc/firejail.config; do \
		install -c -m 0644 $$file $(DESTDIR)/$(sysconfdir)/firejail; \
	done
123
	sh -c "if [ ! -f $(DESTDIR)/$(sysconfdir)/firejail/login.users ]; then install -c -m 0644 etc/login.users $(DESTDIR)/$(sysconfdir)/firejail/.; fi;"
netblue30's avatar
netblue30 committed
124
	rm -fr .etc
Fred Barclay's avatar
Fred Barclay committed
125
ifeq ($(HAVE_APPARMOR),-DHAVE_APPARMOR)
netblue30's avatar
netblue30 committed
126
	# install apparmor profile
127
	sh -c "if [ ! -d $(DESTDIR)/$(sysconfdir)/apparmor.d ]; then install -d -m 755 $(DESTDIR)/$(sysconfdir)/apparmor.d; fi;"
128
	install -c -m 0644 etc/firejail-default $(DESTDIR)/$(sysconfdir)/apparmor.d/.
Fred Barclay's avatar
Fred Barclay committed
129
endif
130
	# man pages
netblue30's avatar
netblue30 committed
131 132
	install -m 0755 -d $(DESTDIR)/$(mandir)/man1
	install -m 0755 -d $(DESTDIR)/$(mandir)/man5
133 134 135 136 137 138 139 140 141
	for man in $(MANPAGES); do \
		rm -f $$man.gz; \
		gzip -9n $$man; \
		case "$$man" in \
			*.1) install -c -m 0644 $$man.gz $(DESTDIR)/$(mandir)/man1/; ;; \
			*.5) install -c -m 0644 $$man.gz $(DESTDIR)/$(mandir)/man5/; ;; \
		esac; \
	done
	rm -f $(MANPAGES) $(MANPAGES:%=%.gz)
142
	# bash completion
netblue30's avatar
netblue30 committed
143
	install -m 0755 -d $(DESTDIR)/$(datarootdir)/bash-completion/completions
144 145
	install -c -m 0644 src/bash_completion/firejail.bash_completion $(DESTDIR)/$(datarootdir)/bash-completion/completions/firejail
	install -c -m 0644 src/bash_completion/firemon.bash_completion $(DESTDIR)/$(datarootdir)/bash-completion/completions/firemon
netblue30's avatar
netblue30 committed
146
	install -c -m 0644 src/bash_completion/firecfg.bash_completion $(DESTDIR)/$(datarootdir)/bash-completion/completions/firecfg
147

148 149 150
install: all
	$(MAKE) realinstall

151
install-strip: all
netblue30's avatar
netblue30 committed
152 153
	strip src/firejail/firejail
	strip src/firemon/firemon
netblue30's avatar
netblue30 committed
154
	strip src/firecfg/firecfg
netblue30's avatar
netblue30 committed
155
	strip src/libtrace/libtrace.so
netblue30's avatar
netblue30 committed
156
	strip src/libtracelog/libtracelog.so
netblue30's avatar
netblue30 committed
157
	strip src/ftee/ftee
netblue30's avatar
netblue30 committed
158
	strip src/faudit/faudit
netblue30's avatar
netblue30 committed
159
	strip src/fnet/fnet
netblue30's avatar
netblue30 committed
160
	strip src/fseccomp/fseccomp
netblue30's avatar
netblue30 committed
161
	strip src/fcopy/fcopy
162
	$(MAKE) realinstall
netblue30's avatar
netblue30 committed
163

164
uninstall:
165 166
	rm -f $(DESTDIR)/$(bindir)/firejail
	rm -f $(DESTDIR)/$(bindir)/firemon
netblue30's avatar
netblue30 committed
167
	rm -f $(DESTDIR)/$(bindir)/firecfg
168 169
	rm -fr $(DESTDIR)/$(libdir)/firejail
	rm -fr $(DESTDIR)/$(datarootdir)/doc/firejail
170 171 172 173
	for man in $(MANPAGES); do \
		rm -f $(DESTDIR)/$(mandir)/man5/$$man*; \
		rm -f $(DESTDIR)/$(mandir)/man1/$$man*; \
	done
174 175
	rm -f $(DESTDIR)/$(datarootdir)/bash-completion/completions/firejail
	rm -f $(DESTDIR)/$(datarootdir)/bash-completion/completions/firemon
netblue30's avatar
netblue30 committed
176
	rm -f $(DESTDIR)/$(datarootdir)/bash-completion/completions/firecfg
Fred Barclay's avatar
Fred Barclay committed
177

netblue30's avatar
netblue30 committed
178
DISTFILES = "src etc platform contrib configure configure.ac Makefile.in install.sh mkman.sh mketc.sh mkdeb.sh mkuid.sh COPYING README RELNOTES"
netblue30's avatar
netblue30 committed
179
DISTFILES_TEST = "test/apps test/apps-x11 test/apps-x11-xorg test/root test/fcopy test/environment test/profiles test/utils test/compile test/filters test/network test/arguments test/fs test/sysutils"
180

netblue30's avatar
netblue30 committed
181
dist:
182
	mv config.status config.status.old
netblue30's avatar
netblue30 committed
183
	make distclean
184
	mv config.status.old config.status
185
	rm -fr $(NAME)-$(VERSION) $(NAME)-$(VERSION).tar.xz
186 187 188 189 190
	mkdir -p $(NAME)-$(VERSION)/test
	cp -a "$(DISTFILES)" $(NAME)-$(VERSION)
	cp -a "$(DISTFILES_TEST)" $(NAME)-$(VERSION)/test
	rm -rf $(NAME)-$(VERSION)/src/tools
	find $(NAME)-$(VERSION) -name .svn -delete
191
	tar -cJvf $(NAME)-$(VERSION).tar.xz $(NAME)-$(VERSION)
netblue30's avatar
netblue30 committed
192 193
	rm -fr $(NAME)-$(VERSION)

netblue30's avatar
netblue30 committed
194 195
asc:; ./mkasc.sh $(VERSION)

netblue30's avatar
netblue30 committed
196 197 198
deb: dist
	./mkdeb.sh $(NAME) $(VERSION)

netblue30's avatar
netblue30 committed
199 200 201
snap: all
	cd platform/snap; ./snap.sh

netblue30's avatar
netblue30 committed
202 203 204
install-snap: snap
	sudo snap remove faudit; sudo snap install faudit*.snap

netblue30's avatar
netblue30 committed
205 206
test-compile: dist
	cd test/compile; ./compile.sh $(NAME)-$(VERSION)
netblue30's avatar
netblue30 committed
207

208 209 210 211
.PHONY: rpms
rpms:
	./platform/rpm/mkrpm.sh $(NAME) $(VERSION)

netblue30's avatar
netblue30 committed
212 213
extras: all
	$(MAKE) -C extras/firetools
Fred Barclay's avatar
Fred Barclay committed
214

netblue30's avatar
netblue30 committed
215 216 217 218 219
cppcheck: clean
	cppcheck --force .

scan-build: clean
	scan-build make
netblue30's avatar
netblue30 committed
220

netblue30's avatar
netblue30 committed
221 222 223 224 225

#
# make test
#

netblue30's avatar
netblue30 committed
226

netblue30's avatar
netblue30 committed
227 228 229
test-profiles:
	cd test/profiles; ./profiles.sh | grep TESTING

netblue30's avatar
netblue30 committed
230 231 232
test-apps:
	cd test/apps; ./apps.sh | grep TESTING

netblue30's avatar
netblue30 committed
233 234 235
test-apps-x11:
	cd test/apps-x11; ./apps-x11.sh | grep TESTING

netblue30's avatar
netblue30 committed
236 237 238
test-apps-x11-xorg:
	cd test/apps-x11-xorg; ./apps-x11-xorg.sh | grep TESTING

netblue30's avatar
netblue30 committed
239 240
test-sysutils:
	cd test/sysutils; ./sysutils.sh | grep TESTING
Fred Barclay's avatar
Fred Barclay committed
241

netblue30's avatar
netblue30 committed
242 243 244
test-utils:
	cd test/utils; ./utils.sh | grep TESTING

netblue30's avatar
netblue30 committed
245 246 247
test-environment:
	cd test/environment; ./environment.sh | grep TESTING

netblue30's avatar
netblue30 committed
248
test-filters:
Duncan Overbruck's avatar
Duncan Overbruck committed
249
ifeq ($(HAVE_SECCOMP),-DHAVE_SECCOMP)
netblue30's avatar
netblue30 committed
250
	cd test/filters; ./filters.sh | grep TESTING
Duncan Overbruck's avatar
Duncan Overbruck committed
251
endif
netblue30's avatar
netblue30 committed
252

netblue30's avatar
netblue30 committed
253 254
test-arguments:
	cd test/arguments; ./arguments.sh | grep TESTING
Fred Barclay's avatar
Fred Barclay committed
255

netblue30's avatar
netblue30 committed
256 257 258
test-fs:
	cd test/fs; ./fs.sh | grep TESTING

netblue30's avatar
netblue30 committed
259 260
test-fcopy:
	cd test/fcopy; ./fcopy.sh | grep TESTING
Fred Barclay's avatar
Fred Barclay committed
261

netblue30's avatar
netblue30 committed
262
test: test-profiles test-fcopy test-fs test-utils  test-environment test-apps test-apps-x11 test-apps-x11-xorg test-filters test-arguments
netblue30's avatar
netblue30 committed
263
	echo "TEST COMPLETE"
netblue30's avatar
netblue30 committed
264

netblue30's avatar
netblue30 committed
265 266 267 268 269
##########################################
# Individual tests, some of them require root access
# The tests are very intrussive, by the time you are done
# with them you will need to restart your computer.
##########################################
netblue30's avatar
netblue30 committed
270

netblue30's avatar
netblue30 committed
271 272 273 274
# requires root access
test-chroot:
	cd test/chroot; ./chroot.sh | grep testing

netblue30's avatar
netblue30 committed
275 276 277 278 279 280
# Huge appimage files, not included in "make dist" archive
test-appimage:
	cd test/appimage; ./appimage.sh | grep TESTING

# Root access, network devices are created before the test
# restart your computer to get rid of these devices
netblue30's avatar
netblue30 committed
281 282 283
test-network:
	cd test/network; ./network.sh | grep TESTING

netblue30's avatar
netblue30 committed
284 285 286
# requires the same setup as test-network
test-stress:
	cd test/stress; ./stress.sh | grep TESTING
Fred Barclay's avatar
Fred Barclay committed
287

netblue30's avatar
netblue30 committed
288
# Tesets running a root user
netblue30's avatar
netblue30 committed
289 290
test-root:
	cd test/root; su -c ./root.sh | grep TESTING
Fred Barclay's avatar
Fred Barclay committed
291

netblue30's avatar
netblue30 committed
292
# OverlayFS is not available on all platforms
netblue30's avatar
netblue30 committed
293 294 295
test-overlay:
	cd test/overlay; ./overlay.sh | grep TESTING

netblue30's avatar
netblue30 committed
296 297
# For testing hidepid system, the command to set it up is "mount -o remount,rw,hidepid=2 /proc"

netblue30's avatar
netblue30 committed
298
test-all: test-root test-chroot test-network test-appimage test-overlay
netblue30's avatar
netblue30 committed
299
	echo "TEST COMPLETE"