Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: reduce autoconf input files from 32 to 2 #5219

Merged
merged 3 commits into from
Jun 30, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
.directory
*.man
.vscode
Makefile
autom4te.cache/
config.log
config.mk
Expand All @@ -25,7 +24,6 @@ firejail.1
firemon.1
firecfg.1
jailcheck.1
mkdeb.sh
src/fnettrace-dns/fnettrace-dns
src/fnettrace-sni/fnettrace-sni
src/firejail/firejail
Expand Down Expand Up @@ -57,7 +55,6 @@ seccomp.64
seccomp.block_secondary
seccomp.mdwx
seccomp.mdwx.32
src/common.mk
aclocal.m4
__pycache__
*.pyc
Expand Down
35 changes: 19 additions & 16 deletions Makefile.in → Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
include config.mk
-include config.mk

ifneq ($(HAVE_MAN),no)
MAN_TARGET = man
Expand All @@ -21,6 +21,10 @@ MANPAGES = firejail.1 firemon.1 firecfg.1 firejail-profile.5 firejail-login.5 fi
SECCOMP_FILTERS = seccomp seccomp.debug seccomp.32 seccomp.block_secondary seccomp.mdwx seccomp.mdwx.32
ALL_ITEMS = $(APPS) $(SBOX_APPS) $(SBOX_APPS_NON_DUMPABLE) $(MYLIBS)

config.mk config.sh:
printf 'run ./configure to generate %s\n' "$@" >&2
false

.PHONY: all_items $(ALL_ITEMS)
all_items: $(ALL_ITEMS)
$(ALL_ITEMS): $(MYDIRS)
Expand All @@ -31,7 +35,7 @@ mydirs: $(MYDIRS)
$(MYDIRS):
$(MAKE) -C $@

$(MANPAGES): src/man
$(MANPAGES): src/man config.mk
./mkman.sh $(VERSION) src/man/$(basename $@).man $@

man: $(MANPAGES)
Expand Down Expand Up @@ -85,9 +89,9 @@ distclean: clean
$(MAKE) -C $$dir distclean; \
done
$(MAKE) -C test distclean
rm -fr Makefile autom4te.cache config.log config.mk config.sh config.status src/common.mk mkdeb.sh
rm -fr autom4te.cache config.log config.mk config.sh config.status

realinstall:
realinstall: config.mk
# firejail executable
install -m 0755 -d $(DESTDIR)$(bindir)
install -m 0755 src/firejail/firejail $(DESTDIR)$(bindir)
Expand Down Expand Up @@ -171,7 +175,7 @@ install-strip: all
strip $(ALL_ITEMS)
$(MAKE) realinstall

uninstall:
uninstall: config.mk
rm -f $(DESTDIR)$(bindir)/firejail
rm -f $(DESTDIR)$(bindir)/firemon
rm -f $(DESTDIR)$(bindir)/firecfg
Expand All @@ -189,7 +193,7 @@ uninstall:

DISTFILES = \
COPYING \
Makefile.in \
Makefile \
README \
RELNOTES \
config.mk.in \
Expand All @@ -200,20 +204,18 @@ contrib \
etc \
install.sh \
m4 \
mkdeb.sh.in \
mkdeb.sh \
mketc.sh \
mkman.sh \
platform \
src

DISTFILES_TEST = test/Makefile.in test/apps test/apps-x11 test/apps-x11-xorg test/root test/private-lib test/fnetfilter test/fcopy test/environment test/profiles test/utils test/compile test/filters test/network test/fs test/sysutils test/chroot
DISTFILES_TEST = test/Makefile test/apps test/apps-x11 test/apps-x11-xorg test/root test/private-lib test/fnetfilter test/fcopy test/environment test/profiles test/utils test/compile test/filters test/network test/fs test/sysutils test/chroot

dist:
dist: config.mk
mv config.sh config.sh.old
mv config.status config.status.old
mv mkdeb.sh mkdeb.sh.old
make distclean
mv mkdeb.sh.old mkdeb.sh
mv config.status.old config.status
mv config.sh.old config.sh
rm -fr $(NAME)-$(VERSION) $(NAME)-$(VERSION).tar.xz
Expand All @@ -225,19 +227,20 @@ dist:
tar -cJvf $(NAME)-$(VERSION).tar.xz $(NAME)-$(VERSION)
rm -fr $(NAME)-$(VERSION)

asc:; ./mkasc.sh $(VERSION)
asc: config.mk
./mkasc.sh $(VERSION)

deb: dist
deb: dist config.sh
./mkdeb.sh

deb-apparmor: dist
deb-apparmor: dist config.sh
./mkdeb.sh -apparmor --enable-apparmor

test-compile: dist
test-compile: dist config.mk
cd test/compile; ./compile.sh $(NAME)-$(VERSION)

.PHONY: rpms
rpms: src/man
rpms: src/man config.mk
./platform/rpm/mkrpm.sh $(NAME) $(VERSION)

extras: all
Expand Down
39 changes: 1 addition & 38 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -4085,9 +4085,7 @@ if test "$prefix" = /usr; then
test "$sysconfdir" = '${prefix}/etc' && sysconfdir="/etc"
fi

ac_config_files="$ac_config_files mkdeb.sh"

ac_config_files="$ac_config_files Makefile config.mk config.sh src/bash_completion/Makefile src/common.mk src/fbuilder/Makefile src/fcopy/Makefile src/fids/Makefile src/firecfg/Makefile src/firejail/Makefile src/firemon/Makefile src/fldd/Makefile src/fnet/Makefile src/fnetfilter/Makefile src/fnettrace-dns/Makefile src/fnettrace-sni/Makefile src/fnettrace/Makefile src/fsec-optimize/Makefile src/fsec-print/Makefile src/fseccomp/Makefile src/ftee/Makefile src/fzenity/Makefile src/jailcheck/Makefile src/lib/Makefile src/libpostexecseccomp/Makefile src/libtrace/Makefile src/libtracelog/Makefile src/man/Makefile src/profstats/Makefile src/zsh_completion/Makefile test/Makefile"
ac_config_files="$ac_config_files config.mk config.sh"

cat >confcache <<\_ACEOF
# This file is a shell script that caches the results of configure
Expand Down Expand Up @@ -4795,38 +4793,8 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
for ac_config_target in $ac_config_targets
do
case $ac_config_target in
"mkdeb.sh") CONFIG_FILES="$CONFIG_FILES mkdeb.sh" ;;
"Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
"config.mk") CONFIG_FILES="$CONFIG_FILES config.mk" ;;
"config.sh") CONFIG_FILES="$CONFIG_FILES config.sh" ;;
"src/bash_completion/Makefile") CONFIG_FILES="$CONFIG_FILES src/bash_completion/Makefile" ;;
"src/common.mk") CONFIG_FILES="$CONFIG_FILES src/common.mk" ;;
"src/fbuilder/Makefile") CONFIG_FILES="$CONFIG_FILES src/fbuilder/Makefile" ;;
"src/fcopy/Makefile") CONFIG_FILES="$CONFIG_FILES src/fcopy/Makefile" ;;
"src/fids/Makefile") CONFIG_FILES="$CONFIG_FILES src/fids/Makefile" ;;
"src/firecfg/Makefile") CONFIG_FILES="$CONFIG_FILES src/firecfg/Makefile" ;;
"src/firejail/Makefile") CONFIG_FILES="$CONFIG_FILES src/firejail/Makefile" ;;
"src/firemon/Makefile") CONFIG_FILES="$CONFIG_FILES src/firemon/Makefile" ;;
"src/fldd/Makefile") CONFIG_FILES="$CONFIG_FILES src/fldd/Makefile" ;;
"src/fnet/Makefile") CONFIG_FILES="$CONFIG_FILES src/fnet/Makefile" ;;
"src/fnetfilter/Makefile") CONFIG_FILES="$CONFIG_FILES src/fnetfilter/Makefile" ;;
"src/fnettrace-dns/Makefile") CONFIG_FILES="$CONFIG_FILES src/fnettrace-dns/Makefile" ;;
"src/fnettrace-sni/Makefile") CONFIG_FILES="$CONFIG_FILES src/fnettrace-sni/Makefile" ;;
"src/fnettrace/Makefile") CONFIG_FILES="$CONFIG_FILES src/fnettrace/Makefile" ;;
"src/fsec-optimize/Makefile") CONFIG_FILES="$CONFIG_FILES src/fsec-optimize/Makefile" ;;
"src/fsec-print/Makefile") CONFIG_FILES="$CONFIG_FILES src/fsec-print/Makefile" ;;
"src/fseccomp/Makefile") CONFIG_FILES="$CONFIG_FILES src/fseccomp/Makefile" ;;
"src/ftee/Makefile") CONFIG_FILES="$CONFIG_FILES src/ftee/Makefile" ;;
"src/fzenity/Makefile") CONFIG_FILES="$CONFIG_FILES src/fzenity/Makefile" ;;
"src/jailcheck/Makefile") CONFIG_FILES="$CONFIG_FILES src/jailcheck/Makefile" ;;
"src/lib/Makefile") CONFIG_FILES="$CONFIG_FILES src/lib/Makefile" ;;
"src/libpostexecseccomp/Makefile") CONFIG_FILES="$CONFIG_FILES src/libpostexecseccomp/Makefile" ;;
"src/libtrace/Makefile") CONFIG_FILES="$CONFIG_FILES src/libtrace/Makefile" ;;
"src/libtracelog/Makefile") CONFIG_FILES="$CONFIG_FILES src/libtracelog/Makefile" ;;
"src/man/Makefile") CONFIG_FILES="$CONFIG_FILES src/man/Makefile" ;;
"src/profstats/Makefile") CONFIG_FILES="$CONFIG_FILES src/profstats/Makefile" ;;
"src/zsh_completion/Makefile") CONFIG_FILES="$CONFIG_FILES src/zsh_completion/Makefile" ;;
"test/Makefile") CONFIG_FILES="$CONFIG_FILES test/Makefile" ;;

*) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;;
esac
Expand Down Expand Up @@ -5240,11 +5208,6 @@ which seems to be undefined. Please make sure it is defined" >&2;}

esac


case $ac_file$ac_mode in
"mkdeb.sh":F) chmod +x mkdeb.sh ;;

esac
done # for ac_tag


Expand Down
35 changes: 1 addition & 34 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -282,40 +282,7 @@ if test "$prefix" = /usr; then
test "$sysconfdir" = '${prefix}/etc' && sysconfdir="/etc"
fi

AC_CONFIG_FILES([mkdeb.sh], [chmod +x mkdeb.sh])
AC_CONFIG_FILES([
Makefile
config.mk
config.sh
src/bash_completion/Makefile
src/common.mk
src/fbuilder/Makefile
src/fcopy/Makefile
src/fids/Makefile
src/firecfg/Makefile
src/firejail/Makefile
src/firemon/Makefile
src/fldd/Makefile
src/fnet/Makefile
src/fnetfilter/Makefile
src/fnettrace-dns/Makefile
src/fnettrace-sni/Makefile
src/fnettrace/Makefile
src/fsec-optimize/Makefile
src/fsec-print/Makefile
src/fseccomp/Makefile
src/ftee/Makefile
src/fzenity/Makefile
src/jailcheck/Makefile
src/lib/Makefile
src/libpostexecseccomp/Makefile
src/libtrace/Makefile
src/libtracelog/Makefile
src/man/Makefile
src/profstats/Makefile
src/zsh_completion/Makefile
test/Makefile
])
AC_CONFIG_FILES([config.mk config.sh])
AC_OUTPUT

cat <<EOF
Expand Down
8 changes: 4 additions & 4 deletions contrib/fj-mkdeb.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
def run(srcdir, args):
if srcdir: os.chdir(srcdir)

if not (os.path.isfile('./mkdeb.sh.in')):
if not (os.path.isfile('./mkdeb.sh')):
print('Error: Not a firejail source tree? Exiting.')
return 1

Expand All @@ -22,7 +22,7 @@ def run(srcdir, args):
# prefix should ALWAYS be /usr here. Discard user-set values
args.remove(a)

# Run configure to generate mkdeb.sh.
# Run configure to generate config.sh.
first_config = subprocess.call(['./configure', '--prefix=/usr'] + args)
if first_config != 0:
return first_config
Expand Down Expand Up @@ -62,9 +62,9 @@ def run(srcdir, args):
if not (srcdir):
# srcdir not manually specified, try to auto-detect
srcdir = os.path.dirname(os.path.abspath(sys.argv[0] + '/..'))
if not (os.path.isfile(srcdir + '/mkdeb.sh.in')):
if not (os.path.isfile(srcdir + '/mkdeb.sh')):
# Script is probably installed. Check the cwd.
if os.path.isfile('./mkdeb.sh.in'):
if os.path.isfile('./mkdeb.sh'):
srcdir = None
else:
print(
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
all: firejail.bash_completion

ROOT = ../..
include $(ROOT)/config.mk
-include $(ROOT)/config.mk

firejail.bash_completion: firejail.bash_completion.in
firejail.bash_completion: firejail.bash_completion.in $(ROOT)/config.mk
gawk -f ../man/preproc.awk -- $(MANFLAGS) < $< > $@.tmp
sed "s|_SYSCONFDIR_|$(sysconfdir)|" < $@.tmp > $@
rm $@.tmp
Expand All @@ -15,4 +15,3 @@ clean:

.PHONY: distclean
distclean: clean
rm -fr Makefile
2 changes: 1 addition & 1 deletion src/common.mk.in → src/common.mk
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#
# Note: "ROOT" must be defined before including this file.

include $(ROOT)/config.mk
-include $(ROOT)/config.mk

H_FILE_LIST = $(sort $(wildcard *.h))
C_FILE_LIST = $(sort $(wildcard *.c))
Expand Down
5 changes: 2 additions & 3 deletions src/fbuilder/Makefile.in → src/fbuilder/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,14 @@ all: fbuilder
ROOT = ../..
include $(ROOT)/src/common.mk

%.o : %.c $(H_FILE_LIST) ../include/common.h ../include/syscall.h
%.o : %.c $(H_FILE_LIST) ../include/common.h ../include/syscall.h $(ROOT)/config.mk
$(CC) $(CFLAGS) $(EXTRA_CFLAGS) $(INCLUDE) -c $< -o $@

fbuilder: $(OBJS)
fbuilder: $(OBJS) $(ROOT)/config.mk
$(CC) $(LDFLAGS) -o $@ $(OBJS) $(LIBS) $(EXTRA_LDFLAGS)

.PHONY: clean
clean:; rm -fr *.o fbuilder *.gcov *.gcda *.gcno *.plist

.PHONY: distclean
distclean: clean
rm -fr Makefile
5 changes: 2 additions & 3 deletions src/fcopy/Makefile.in → src/fcopy/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,14 @@ all: fcopy
ROOT = ../..
include $(ROOT)/src/common.mk

%.o : %.c $(H_FILE_LIST) ../include/common.h ../include/syscall.h
%.o : %.c $(H_FILE_LIST) ../include/common.h ../include/syscall.h $(ROOT)/config.mk
$(CC) $(CFLAGS) $(EXTRA_CFLAGS) $(INCLUDE) -c $< -o $@

fcopy: $(OBJS) ../lib/common.o
fcopy: $(OBJS) ../lib/common.o $(ROOT)/config.mk
$(CC) $(LDFLAGS) -o $@ $(OBJS) ../lib/common.o $(LIBS) $(EXTRA_LDFLAGS)

.PHONY: clean
clean:; rm -fr *.o fcopy *.gcov *.gcda *.gcno *.plist

.PHONY: distclean
distclean: clean
rm -fr Makefile
5 changes: 2 additions & 3 deletions src/fids/Makefile.in → src/fids/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,15 @@ all: fids
ROOT = ../..
include $(ROOT)/src/common.mk

%.o : %.c $(H_FILE_LIST) ../include/common.h
%.o : %.c $(H_FILE_LIST) ../include/common.h $(ROOT)/config.mk
$(CC) $(CFLAGS) $(EXTRA_CFLAGS) $(INCLUDE) -c $< -o $@

#fseccomp: $(OBJS) ../lib/common.o ../lib/errno.o ../lib/syscall.o
fids: $(OBJS)
fids: $(OBJS) $(ROOT)/config.mk
$(CC) $(LDFLAGS) -o $@ $(OBJS) $(LIBS) $(EXTRA_LDFLAGS)

.PHONY: clean
clean:; rm -fr *.o fids *.gcov *.gcda *.gcno *.plist

.PHONY: distclean
distclean: clean
rm -fr Makefile
5 changes: 2 additions & 3 deletions src/firecfg/Makefile.in → src/firecfg/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,14 @@ all: firecfg
ROOT = ../..
include $(ROOT)/src/common.mk

%.o : %.c $(H_FILE_LIST) ../include/common.h ../include/euid_common.h ../include/libnetlink.h ../include/firejail_user.h ../include/pid.h
%.o : %.c $(H_FILE_LIST) ../include/common.h ../include/euid_common.h ../include/libnetlink.h ../include/firejail_user.h ../include/pid.h $(ROOT)/config.mk
$(CC) $(CFLAGS) $(EXTRA_CFLAGS) $(INCLUDE) -c $< -o $@

firecfg: $(OBJS) ../lib/common.o ../lib/firejail_user.o
firecfg: $(OBJS) ../lib/common.o ../lib/firejail_user.o $(ROOT)/config.mk
$(CC) $(LDFLAGS) -o $@ $(OBJS) ../lib/common.o ../lib/firejail_user.o $(LIBS) $(EXTRA_LDFLAGS)

.PHONY: clean
clean:; rm -fr *.o firecfg *.gcov *.gcda *.gcno *.plist

.PHONY: distclean
distclean: clean
rm -fr Makefile
5 changes: 2 additions & 3 deletions src/firejail/Makefile.in → src/firejail/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,14 @@ all: firejail
ROOT = ../..
include $(ROOT)/src/common.mk

%.o : %.c $(H_FILE_LIST) ../include/rundefs.h ../include/common.h ../include/ldd_utils.h ../include/euid_common.h ../include/pid.h ../include/seccomp.h ../include/syscall_i386.h ../include/syscall_x86_64.h ../include/firejail_user.h
%.o : %.c $(H_FILE_LIST) ../include/rundefs.h ../include/common.h ../include/ldd_utils.h ../include/euid_common.h ../include/pid.h ../include/seccomp.h ../include/syscall_i386.h ../include/syscall_x86_64.h ../include/firejail_user.h $(ROOT)/config.mk
$(CC) $(CFLAGS) $(EXTRA_CFLAGS) $(INCLUDE) -c $< -o $@

firejail: $(OBJS) ../lib/libnetlink.o ../lib/common.o ../lib/ldd_utils.o ../lib/firejail_user.o ../lib/errno.o ../lib/syscall.o
firejail: $(OBJS) ../lib/libnetlink.o ../lib/common.o ../lib/ldd_utils.o ../lib/firejail_user.o ../lib/errno.o ../lib/syscall.o $(ROOT)/config.mk
$(CC) $(LDFLAGS) -o $@ $(OBJS) ../lib/common.o ../lib/ldd_utils.o ../lib/firejail_user.o ../lib/errno.o ../lib/syscall.o $(LIBS) $(EXTRA_LDFLAGS)

.PHONY: clean
clean:; rm -fr *.o firejail *.gcov *.gcda *.gcno *.plist

.PHONY: distclean
distclean: clean
rm -fr Makefile
5 changes: 2 additions & 3 deletions src/firemon/Makefile.in → src/firemon/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,14 @@ all: firemon
ROOT = ../..
include $(ROOT)/src/common.mk

%.o : %.c $(H_FILE_LIST) ../include/common.h ../include/pid.h
%.o : %.c $(H_FILE_LIST) ../include/common.h ../include/pid.h $(ROOT)/config.mk
$(CC) $(CFLAGS) $(EXTRA_CFLAGS) $(INCLUDE) -c $< -o $@

firemon: $(OBJS) ../lib/common.o ../lib/pid.o
firemon: $(OBJS) ../lib/common.o ../lib/pid.o $(ROOT)/config.mk
$(CC) $(LDFLAGS) -o $@ $(OBJS) ../lib/common.o ../lib/pid.o $(LIBS) $(EXTRA_LDFLAGS)

.PHONY: clean
clean:; rm -fr *.o firemon *.gcov *.gcda *.gcno *.plist

.PHONY: distclean
distclean: clean
rm -fr Makefile
Loading