[apparmor] [patch] fun with the toplevel Makefile

Christian Boltz apparmor at cboltz.de
Fri Jan 16 17:23:29 UTC 2015


Hello,

I just tried running   make   in the toplevel of a bzr trunk checkout,
which resulted in a quite funny result:


# make
... make clean in various subdirectories ....
make[1]: Leaving directory '/home/cb/apparmor/HEAD-clean/tests'
__REPO_VERSION=`([ -x /usr/bin/bzr ] && /usr/bin/bzr version-info . 2> /dev/null || awk '{ print "revno: "$2 }' common/.stamp_rev) | awk '/^revno:/ { print $2 }'` ; \
__TARBALL=-2.9.90-${__REPO_VERSION}.tar.gz ; \
make ${__TARBALL} ; \
cp ${__TARBALL} /usr/src/packages/SOURCES/
make: invalid option -- '2'
make: invalid option -- '.'
make: invalid option -- '9'
make: invalid option -- '.'
make: invalid option -- '9'
make: invalid option -- '0'
make: invalid option -- '-'
make: invalid option -- '2'
make: invalid option -- '8'
make: invalid option -- '4'
make: invalid option -- '7'
make: invalid option -- '.'
make: invalid option -- 'a'
make: invalid option -- '.'
make: invalid option -- 'g'
make: invalid option -- 'z'
Usage: make [options] [target] ...
[...]


Note that we actually have several bugs here:
- "tarball" is the default make target, which is at least unexpected
  (well, actually that's wrong - thanks to including common/Make.rules,
  the "rpm" target is used, which then calls "make $${__TARBALL}")
- needless to say that it's not really nice to hit the default target of
  common/Make.rules ;-)
- common/Make.rules does
    __TARBALL=$(NAME)-$(VERSION)-$${__REPO_VERSION}.tar.gz
  but $(NAME) is obviously empty at this point (no idea where it is 
  usually set)
- oh, and all this means "make rpm" is broken ;-)


The following patch adds a "common_Make.rules_is_a_bad_target" target
to common/Make.rules to make sure nothing accidently hits the first-best
target (well, first-not-so-good would better describe the rpm target ;-)

It also adds a dummy "all:" target to the toplevel Makefile with a 
short hint towards README.

It does _not_ fix "make rpm" target. With *.spec moved to deprecated/,
we should probably just drop that part from the Makefile. (Volunteers
welcome - I'd have to read through the Makefile to find out if there are
additional sections that become superfluous when deleting the rpm target.)


=== modified file 'Makefile'
--- Makefile    2014-03-20 21:52:03 +0000
+++ Makefile    2015-01-16 17:10:09 +0000
@@ -2,6 +2,11 @@
 #
 OVERRIDE_TARBALL=yes
 
+.PHONY: all
+all:
+       @echo "*** See README for information how to build AppArmor ***"
+       exit 1
+
 include common/Make.rules
 
 DIRS=parser \

=== modified file 'common/Make.rules'
--- common/Make.rules   2014-10-16 22:50:13 +0000
+++ common/Make.rules   2015-01-16 17:14:45 +0000
@@ -24,6 +24,11 @@
 #     Make.rules files that already exist in the individual application
 #     directories
 
+.PHONY: common_Make.rules_is_a_bad_target
+common_Make.rules_is_a_bad_target:
+       @echo "*** default target in common/Make.rules hit - either you did something strange, or something is broken... ***"
+       exit 1
+
 DISTRIBUTION=AppArmor
 VERSION=$(shell cat common/Version)
 


Regards,

Christian Boltz
-- 
Die fünf Sinne des C++-Programmierers:
Der Schwachsinn, der Blödsinn, der Wahnsinn, der Unsinn
und der Stumpfsinn.   [Holger Veit]




More information about the AppArmor mailing list