Makefile.in 9.36 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@
netblue30's avatar
netblue30 committed
19
HAVE_APPARMOR=@HAVE_APPARMOR@
20
BUSYBOX_WORKAROUND=@BUSYBOX_WORKAROUND@
netblue30's avatar
netblue30 committed
21

22 23
uids.h:; ./mkuid.sh

netblue30's avatar
netblue30 committed
24
.PHONY: mylibs $(MYLIBS)
25
mylibs: $(MYLIBS) uids.h
netblue30's avatar
netblue30 committed
26 27 28 29 30
$(MYLIBS):
	$(MAKE) -C $@

.PHONY: apps $(APPS)
apps: $(APPS)
31
$(APPS): $(MYLIBS) uids.h
netblue30's avatar
netblue30 committed
32 33
	$(MAKE) -C $@

34 35 36 37
$(MANPAGES): $(wildcard src/man/*.txt)
	./mkman.sh $(VERSION) src/man/$(basename $@).txt $@

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

netblue30's avatar
netblue30 committed
39 40 41 42 43 44
filters: src/fseccomp
	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

45
clean:
46
	for dir in $(APPS) $(MYLIBS); do \
netblue30's avatar
netblue30 committed
47 48
		$(MAKE) -C $$dir clean; \
	done
49
	rm -f $(MANPAGES) $(MANPAGES:%=%.gz) firejail*.rpm
netblue30's avatar
netblue30 committed
50
	rm -f seccomp seccomp.debug seccomp.i386 seccomp.amd64
netblue30's avatar
netblue30 committed
51
	rm -f test/utils/index.html*
netblue30's avatar
netblue30 committed
52
	rm -f test/utils/wget-log
netblue30's avatar
netblue30 committed
53
	rm -f test/utils/lstesting
netblue30's avatar
netblue30 committed
54 55 56 57
	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
58 59
	rm -f test/environment/index.html
	rm -f test/environment/wget-log
netblue30's avatar
netblue30 committed
60
	rm -f test/sysutils/firejail_t*
netblue30's avatar
netblue30 committed
61
	cd test/compile; ./compile.sh --clean; cd ../..
netblue30's avatar
netblue30 committed
62 63

distclean: clean
64
	for dir in $(APPS) $(MYLIBS); do \
netblue30's avatar
netblue30 committed
65 66
		$(MAKE) -C $$dir distclean; \
	done
67
	rm -fr Makefile autom4te.cache config.log config.status config.h uids.h
netblue30's avatar
netblue30 committed
68

69
realinstall:
70
	# firejail executable
netblue30's avatar
netblue30 committed
71
	install -m 0755 -d $(DESTDIR)/$(bindir)
72 73
	install -c -m 0755 src/firejail/firejail $(DESTDIR)/$(bindir)/.
	chmod u+s $(DESTDIR)/$(bindir)/firejail
74
	# firemon executable
75
	install -c -m 0755 src/firemon/firemon $(DESTDIR)/$(bindir)/.
netblue30's avatar
netblue30 committed
76 77
	# firecfg executable
	install -c -m 0755 src/firecfg/firecfg $(DESTDIR)/$(bindir)/.
78
	# libraries and plugins
netblue30's avatar
netblue30 committed
79
	install -m 0755 -d $(DESTDIR)/$(libdir)/firejail
80
	install -c -m 0644 src/libtrace/libtrace.so $(DESTDIR)/$(libdir)/firejail/.
netblue30's avatar
netblue30 committed
81
	install -c -m 0644 src/libtracelog/libtracelog.so $(DESTDIR)/$(libdir)/firejail/.
82 83
	install -c -m 0755 src/ftee/ftee $(DESTDIR)/$(libdir)/firejail/.
	install -c -m 0755 src/fshaper/fshaper.sh $(DESTDIR)/$(libdir)/firejail/.
84
ifeq ($(HAVE_GIT_INSTALL),-DHAVE_GIT_INSTALL)
netblue30's avatar
netblue30 committed
85 86
	install -c -m 0755 src/fgit/fgit-install.sh $(DESTDIR)/$(libdir)/firejail/.
	install -c -m 0755 src/fgit/fgit-uninstall.sh $(DESTDIR)/$(libdir)/firejail/.
87
endif
netblue30's avatar
netblue30 committed
88
	install -c -m 0644 src/firecfg/firecfg.config $(DESTDIR)/$(libdir)/firejail/.
netblue30's avatar
netblue30 committed
89
	install -c -m 0755 src/faudit/faudit $(DESTDIR)/$(libdir)/firejail/.
netblue30's avatar
netblue30 committed
90
	install -c -m 0755 src/fnet/fnet $(DESTDIR)/$(libdir)/firejail/.
netblue30's avatar
netblue30 committed
91
	install -c -m 0755 src/fseccomp/fseccomp $(DESTDIR)/$(libdir)/firejail/.
netblue30's avatar
netblue30 committed
92
	install -c -m 0755 src/fcopy/fcopy $(DESTDIR)/$(libdir)/firejail/.
netblue30's avatar
netblue30 committed
93 94 95 96
	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/.
netblue30's avatar
netblue30 committed
97 98 99 100
	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/.
101
	install -c -m 0755 contrib/fj-mkdeb.py $(DESTDIR)/$(libdir)/firejail/.
102
	# documents
netblue30's avatar
netblue30 committed
103
	install -m 0755 -d $(DESTDIR)/$(DOCDIR)
104 105 106 107
	install -c -m 0644 COPYING $(DESTDIR)/$(DOCDIR)/.
	install -c -m 0644 README $(DESTDIR)/$(DOCDIR)/.
	install -c -m 0644 RELNOTES $(DESTDIR)/$(DOCDIR)/.
	# etc files
108
	./mketc.sh $(sysconfdir) $(BUSYBOX_WORKAROUND)
netblue30's avatar
netblue30 committed
109
	install -m 0755 -d $(DESTDIR)/$(sysconfdir)/firejail
110 111 112
	for file in .etc/* etc/firejail.config; do \
		install -c -m 0644 $$file $(DESTDIR)/$(sysconfdir)/firejail; \
	done
113
	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
114
	rm -fr .etc
netblue30's avatar
netblue30 committed
115
ifeq ($(HAVE_APPARMOR),-DHAVE_APPARMOR)	
netblue30's avatar
netblue30 committed
116
	# install apparmor profile
117
	sh -c "if [ ! -d $(DESTDIR)/$(sysconfdir)/apparmor.d ]; then install -d -m 755 $(DESTDIR)/$(sysconfdir)/apparmor.d; fi;"
118
	install -c -m 0644 etc/firejail-default $(DESTDIR)/$(sysconfdir)/apparmor.d/.
netblue30's avatar
netblue30 committed
119
endif	
120
	# man pages
netblue30's avatar
netblue30 committed
121 122
	install -m 0755 -d $(DESTDIR)/$(mandir)/man1
	install -m 0755 -d $(DESTDIR)/$(mandir)/man5
123 124 125 126 127 128 129 130 131
	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)
132
	# bash completion
netblue30's avatar
netblue30 committed
133
	install -m 0755 -d $(DESTDIR)/$(datarootdir)/bash-completion/completions
134 135
	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
136
	install -c -m 0644 src/bash_completion/firecfg.bash_completion $(DESTDIR)/$(datarootdir)/bash-completion/completions/firecfg
137

138 139 140
install: all
	$(MAKE) realinstall

141
install-strip: all
netblue30's avatar
netblue30 committed
142 143
	strip src/firejail/firejail
	strip src/firemon/firemon
netblue30's avatar
netblue30 committed
144
	strip src/firecfg/firecfg
netblue30's avatar
netblue30 committed
145
	strip src/libtrace/libtrace.so
netblue30's avatar
netblue30 committed
146
	strip src/libtracelog/libtracelog.so
netblue30's avatar
netblue30 committed
147
	strip src/ftee/ftee
netblue30's avatar
netblue30 committed
148
	strip src/faudit/faudit
netblue30's avatar
netblue30 committed
149
	strip src/fnet/fnet
netblue30's avatar
netblue30 committed
150
	strip src/fseccomp/fseccomp
netblue30's avatar
netblue30 committed
151
	strip src/fcopy/fcopy
152
	$(MAKE) realinstall
netblue30's avatar
netblue30 committed
153

154
uninstall:
155 156
	rm -f $(DESTDIR)/$(bindir)/firejail
	rm -f $(DESTDIR)/$(bindir)/firemon
netblue30's avatar
netblue30 committed
157
	rm -f $(DESTDIR)/$(bindir)/firecfg
158 159
	rm -fr $(DESTDIR)/$(libdir)/firejail
	rm -fr $(DESTDIR)/$(datarootdir)/doc/firejail
160 161 162 163
	for man in $(MANPAGES); do \
		rm -f $(DESTDIR)/$(mandir)/man5/$$man*; \
		rm -f $(DESTDIR)/$(mandir)/man1/$$man*; \
	done
164 165
	rm -f $(DESTDIR)/$(datarootdir)/bash-completion/completions/firejail
	rm -f $(DESTDIR)/$(datarootdir)/bash-completion/completions/firemon
netblue30's avatar
netblue30 committed
166
	rm -f $(DESTDIR)/$(datarootdir)/bash-completion/completions/firecfg
netblue30's avatar
netblue30 committed
167
	
netblue30's avatar
netblue30 committed
168
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
169
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"
170

netblue30's avatar
netblue30 committed
171
dist:
172
	mv config.status config.status.old
netblue30's avatar
netblue30 committed
173
	make distclean
174
	mv config.status.old config.status
175
	rm -fr $(NAME)-$(VERSION) $(NAME)-$(VERSION).tar.xz
176 177 178 179 180
	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
181
	tar -cJvf $(NAME)-$(VERSION).tar.xz $(NAME)-$(VERSION)
netblue30's avatar
netblue30 committed
182 183
	rm -fr $(NAME)-$(VERSION)

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

netblue30's avatar
netblue30 committed
186 187 188
deb: dist
	./mkdeb.sh $(NAME) $(VERSION)

netblue30's avatar
netblue30 committed
189 190 191
snap: all
	cd platform/snap; ./snap.sh

netblue30's avatar
netblue30 committed
192 193 194
install-snap: snap
	sudo snap remove faudit; sudo snap install faudit*.snap

netblue30's avatar
netblue30 committed
195 196
test-compile: dist
	cd test/compile; ./compile.sh $(NAME)-$(VERSION)
netblue30's avatar
netblue30 committed
197

198 199 200 201
.PHONY: rpms
rpms:
	./platform/rpm/mkrpm.sh $(NAME) $(VERSION)

netblue30's avatar
netblue30 committed
202 203
extras: all
	$(MAKE) -C extras/firetools
204
	
netblue30's avatar
netblue30 committed
205 206 207 208 209
cppcheck: clean
	cppcheck --force .

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

netblue30's avatar
netblue30 committed
211 212 213 214 215

#
# make test
#

netblue30's avatar
netblue30 committed
216

netblue30's avatar
netblue30 committed
217 218 219
test-profiles:
	cd test/profiles; ./profiles.sh | grep TESTING

netblue30's avatar
netblue30 committed
220 221 222
test-apps:
	cd test/apps; ./apps.sh | grep TESTING

netblue30's avatar
netblue30 committed
223 224 225
test-apps-x11:
	cd test/apps-x11; ./apps-x11.sh | grep TESTING

netblue30's avatar
netblue30 committed
226 227 228
test-apps-x11-xorg:
	cd test/apps-x11-xorg; ./apps-x11-xorg.sh | grep TESTING

netblue30's avatar
netblue30 committed
229 230 231
test-sysutils:
	cd test/sysutils; ./sysutils.sh | grep TESTING
	
netblue30's avatar
netblue30 committed
232 233 234
test-utils:
	cd test/utils; ./utils.sh | grep TESTING

netblue30's avatar
netblue30 committed
235 236 237
test-environment:
	cd test/environment; ./environment.sh | grep TESTING

netblue30's avatar
netblue30 committed
238 239 240
test-filters:
	cd test/filters; ./filters.sh | grep TESTING

netblue30's avatar
netblue30 committed
241 242 243
test-arguments:
	cd test/arguments; ./arguments.sh | grep TESTING
	
netblue30's avatar
netblue30 committed
244 245 246
test-fs:
	cd test/fs; ./fs.sh | grep TESTING

netblue30's avatar
netblue30 committed
247 248 249
test-fcopy:
	cd test/fcopy; ./fcopy.sh | grep TESTING
	
netblue30's avatar
netblue30 committed
250
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
251
	echo "TEST COMPLETE"
netblue30's avatar
netblue30 committed
252

netblue30's avatar
netblue30 committed
253 254 255 256 257
##########################################
# 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
258

netblue30's avatar
netblue30 committed
259 260 261 262
# requires root access
test-chroot:
	cd test/chroot; ./chroot.sh | grep testing

netblue30's avatar
netblue30 committed
263 264 265 266 267 268
# 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
269 270 271
test-network:
	cd test/network; ./network.sh | grep TESTING

netblue30's avatar
netblue30 committed
272 273 274 275
# requires the same setup as test-network
test-stress:
	cd test/stress; ./stress.sh | grep TESTING
	
netblue30's avatar
netblue30 committed
276
# Tesets running a root user
netblue30's avatar
netblue30 committed
277 278
test-root:
	cd test/root; su -c ./root.sh | grep TESTING
netblue30's avatar
netblue30 committed
279
	
netblue30's avatar
netblue30 committed
280
# OverlayFS is not available on all platforms
netblue30's avatar
netblue30 committed
281 282 283
test-overlay:
	cd test/overlay; ./overlay.sh | grep TESTING

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

netblue30's avatar
netblue30 committed
286
test-all: test-root test-chroot test-network test-appimage test-overlay
netblue30's avatar
netblue30 committed
287
	echo "TEST COMPLETE"
288