Makefile.in 8.91 KB
Newer Older
netblue30's avatar
netblue30 committed
1
all: apps man filters
netblue30's avatar
netblue30 committed
2
MYLIBS = src/lib
netblue30's avatar
netblue30 committed
3
APPS = src/firejail src/firemon src/firecfg src/libtrace src/libtracelog src/ftee src/faudit src/libconnect 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/.
netblue30's avatar
netblue30 committed
82
	install -c -m 0644 src/libconnect/libconnect.so $(DESTDIR)/$(libdir)/firejail/.
83 84
	install -c -m 0755 src/ftee/ftee $(DESTDIR)/$(libdir)/firejail/.
	install -c -m 0755 src/fshaper/fshaper.sh $(DESTDIR)/$(libdir)/firejail/.
netblue30's avatar
netblue30 committed
85
	install -c -m 0644 src/firecfg/firecfg.config $(DESTDIR)/$(libdir)/firejail/.
netblue30's avatar
netblue30 committed
86
	install -c -m 0755 src/faudit/faudit $(DESTDIR)/$(libdir)/firejail/.
netblue30's avatar
netblue30 committed
87
	install -c -m 0755 src/fnet/fnet $(DESTDIR)/$(libdir)/firejail/.
netblue30's avatar
netblue30 committed
88
	install -c -m 0755 src/fseccomp/fseccomp $(DESTDIR)/$(libdir)/firejail/.
netblue30's avatar
netblue30 committed
89
	install -c -m 0755 src/fcopy/fcopy $(DESTDIR)/$(libdir)/firejail/.
netblue30's avatar
netblue30 committed
90 91 92 93
	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/.
94 95 96
	for file in contrib/*; do \
		install -c -m 0755 $$file $(DESTDIR)/$(libdir)/firejail/.; \
	done
97
	# documents
netblue30's avatar
netblue30 committed
98
	install -m 0755 -d $(DESTDIR)/$(DOCDIR)
99 100 101 102
	install -c -m 0644 COPYING $(DESTDIR)/$(DOCDIR)/.
	install -c -m 0644 README $(DESTDIR)/$(DOCDIR)/.
	install -c -m 0644 RELNOTES $(DESTDIR)/$(DOCDIR)/.
	# etc files
103
	./mketc.sh $(sysconfdir) $(BUSYBOX_WORKAROUND)
netblue30's avatar
netblue30 committed
104
	install -m 0755 -d $(DESTDIR)/$(sysconfdir)/firejail
105 106 107
	for file in .etc/* etc/firejail.config; do \
		install -c -m 0644 $$file $(DESTDIR)/$(sysconfdir)/firejail; \
	done
108
	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
109
	rm -fr .etc
netblue30's avatar
netblue30 committed
110
ifeq ($(HAVE_APPARMOR),-DHAVE_APPARMOR)	
netblue30's avatar
netblue30 committed
111
	# install apparmor profile
112
	sh -c "if [ ! -d $(DESTDIR)/$(sysconfdir)/apparmor.d ]; then install -d -m 755 $(DESTDIR)/$(sysconfdir)/apparmor.d; fi;"
113
	install -c -m 0644 etc/firejail-default $(DESTDIR)/$(sysconfdir)/apparmor.d/.
netblue30's avatar
netblue30 committed
114
endif	
115
	# man pages
netblue30's avatar
netblue30 committed
116 117
	install -m 0755 -d $(DESTDIR)/$(mandir)/man1
	install -m 0755 -d $(DESTDIR)/$(mandir)/man5
118 119 120 121 122 123 124 125 126
	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)
127
	# bash completion
netblue30's avatar
netblue30 committed
128
	install -m 0755 -d $(DESTDIR)/$(datarootdir)/bash-completion/completions
129 130
	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
131
	install -c -m 0644 src/bash_completion/firecfg.bash_completion $(DESTDIR)/$(datarootdir)/bash-completion/completions/firecfg
132

133 134 135
install: all
	$(MAKE) realinstall

136
install-strip: all
netblue30's avatar
netblue30 committed
137 138
	strip src/firejail/firejail
	strip src/firemon/firemon
netblue30's avatar
netblue30 committed
139
	strip src/firecfg/firecfg
netblue30's avatar
netblue30 committed
140
	strip src/libtrace/libtrace.so
netblue30's avatar
netblue30 committed
141
	strip src/libtracelog/libtracelog.so
netblue30's avatar
netblue30 committed
142
	strip src/libconnect/libconnect.so
netblue30's avatar
netblue30 committed
143
	strip src/ftee/ftee
netblue30's avatar
netblue30 committed
144
	strip src/faudit/faudit
netblue30's avatar
netblue30 committed
145
	strip src/fnet/fnet
netblue30's avatar
netblue30 committed
146
	strip src/fseccomp/fseccomp
netblue30's avatar
netblue30 committed
147
	strip src/fcopy/fcopy
148
	$(MAKE) realinstall
netblue30's avatar
netblue30 committed
149

150
uninstall:
151 152
	rm -f $(DESTDIR)/$(bindir)/firejail
	rm -f $(DESTDIR)/$(bindir)/firemon
netblue30's avatar
netblue30 committed
153
	rm -f $(DESTDIR)/$(bindir)/firecfg
154 155
	rm -fr $(DESTDIR)/$(libdir)/firejail
	rm -fr $(DESTDIR)/$(datarootdir)/doc/firejail
156 157 158 159
	for man in $(MANPAGES); do \
		rm -f $(DESTDIR)/$(mandir)/man5/$$man*; \
		rm -f $(DESTDIR)/$(mandir)/man1/$$man*; \
	done
160 161
	rm -f $(DESTDIR)/$(datarootdir)/bash-completion/completions/firejail
	rm -f $(DESTDIR)/$(datarootdir)/bash-completion/completions/firemon
netblue30's avatar
netblue30 committed
162
	rm -f $(DESTDIR)/$(datarootdir)/bash-completion/completions/firecfg
netblue30's avatar
netblue30 committed
163
	
164
DISTFILES = "src etc platform configure configure.ac Makefile.in install.sh mkman.sh mketc.sh mkdeb.sh mkuid.sh COPYING README RELNOTES"
netblue30's avatar
netblue30 committed
165
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"
166

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

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

netblue30's avatar
netblue30 committed
182 183 184
deb: dist
	./mkdeb.sh $(NAME) $(VERSION)

netblue30's avatar
netblue30 committed
185 186 187
snap: all
	cd platform/snap; ./snap.sh

netblue30's avatar
netblue30 committed
188 189 190
install-snap: snap
	sudo snap remove faudit; sudo snap install faudit*.snap

netblue30's avatar
netblue30 committed
191 192
test-compile: dist
	cd test/compile; ./compile.sh $(NAME)-$(VERSION)
netblue30's avatar
netblue30 committed
193

194 195 196 197
.PHONY: rpms
rpms:
	./platform/rpm/mkrpm.sh $(NAME) $(VERSION)

netblue30's avatar
netblue30 committed
198 199
extras: all
	$(MAKE) -C extras/firetools
200
	
netblue30's avatar
netblue30 committed
201 202 203 204 205
cppcheck: clean
	cppcheck --force .

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

netblue30's avatar
netblue30 committed
207 208 209 210 211

#
# make test
#

netblue30's avatar
netblue30 committed
212

netblue30's avatar
netblue30 committed
213 214 215
test-profiles:
	cd test/profiles; ./profiles.sh | grep TESTING

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

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

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

netblue30's avatar
netblue30 committed
225 226 227
test-sysutils:
	cd test/sysutils; ./sysutils.sh | grep TESTING
	
netblue30's avatar
netblue30 committed
228 229 230
test-utils:
	cd test/utils; ./utils.sh | grep TESTING

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

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

netblue30's avatar
netblue30 committed
237 238 239
test-arguments:
	cd test/arguments; ./arguments.sh | grep TESTING
	
netblue30's avatar
netblue30 committed
240 241 242
test-fs:
	cd test/fs; ./fs.sh | grep TESTING

netblue30's avatar
netblue30 committed
243 244 245
test-fcopy:
	cd test/fcopy; ./fcopy.sh | grep TESTING
	
netblue30's avatar
netblue30 committed
246
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
247
	echo "TEST COMPLETE"
netblue30's avatar
netblue30 committed
248

netblue30's avatar
netblue30 committed
249 250 251 252 253
##########################################
# 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
254

netblue30's avatar
netblue30 committed
255 256 257 258
# requires root access
test-chroot:
	cd test/chroot; ./chroot.sh | grep testing

netblue30's avatar
netblue30 committed
259 260 261 262 263 264
# 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
265 266 267
test-network:
	cd test/network; ./network.sh | grep TESTING

netblue30's avatar
netblue30 committed
268
# Tesets running a root user
netblue30's avatar
netblue30 committed
269 270
test-root:
	cd test/root; su -c ./root.sh | grep TESTING
netblue30's avatar
netblue30 committed
271
	
netblue30's avatar
netblue30 committed
272
# OverlayFS is not available on all platforms
netblue30's avatar
netblue30 committed
273 274 275
test-overlay:
	cd test/overlay; ./overlay.sh | grep TESTING

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

netblue30's avatar
netblue30 committed
278
test-all: test-root test-chroot test-network test-appimage test-overlay
netblue30's avatar
netblue30 committed
279 280
	echo "TEST COMPLETE"