| Age | Commit message (Collapse) | Author |
|
Makefiles no longer need to include Rules.make, which is currently an
empty file. This patch removes it from the remaining Makefiles, and
removes the empty Rules.make file.
|
|
Alright, so now actually all four phases are converted to new-style,
i.e. we call make -f scripts/Makefile.<phase> which includes the
actual subdir Makefile.
The obvious drawback is some code duplication between the four
scripts/Makefile.<phase>, which could easily be overcome including
shared parts, but since I'm going for maximum performance, I did not
for now.
Rules.make is empty now ;) (Well, not quite, since if it was 0 bytes,
make mrproper would remove it...)
|
|
Including Rules.make after make -C stopped working with the
fixdep changes, so the other code trying to salvage backward
compatibility should go as well.
|
|
Rules.make is used in 4 phases,
o generate modversions
o build
o install modules
o clean
split out the code specific to the phase and move it into
scripts/Makefile.<phase>
|
|
Patch by Peter Samuelson, merged to current code, actually has a noticable
impact on "make clean" speed.
|
|
Do as little as possible apart from calling sub-makes and calling 'rm',
which makes things go quite a bit faster.
|
|
o Having .config depend on all Config.in's via a find is
annoying, since it causes a long break before "make" actually
gets going. Comment it out for now.
o Fix some "make -j" issues with generating module versions.
o Unify "make distclean" and "make mrproper", they were doing nearly the
same thing anyway.
o Use the new "make clean" infrastructure for arch/i386/boot/ and
scripts/
o Reorganize the "make clean" stuff a little, do the
find -name '*.[oas]' | xargs rm -f from the top-level Makefile again
and only use the per-subdir rule for special cases like generated files,
host-progs and the like.
|
|
|
|
Today there is a huge list of files in the top-level Makefile that is
deleted during make clean and make mrproper.
This patch add infrastructure to get rid of this centralised list.
Within a makefile simply use:
clean-files := files-to-be-deleted
or eventually
clean-rule := command to be executed to delete files
Files specified by host-progs and EXTRA_TARGETS are deleted during cleaning,
and the same is all *.[oas] .*.cmd .*.tmp .*.d in the visited directories.
Deleting core files is moved down to mrporper time
Patches utilising this and the centralised list will dismiss.
Based on a concept originally made by Kai Germaschewski
|
|
Since we now always have $(TOPDIR) = `pwd`, some usages of $(TOPDIR)
can go away.
|
|
Instead of recurring problems with non-executable permissions on
files in scripts/, just call them as "sh <script>".
|
|
We removed some files which are long since dead, but on the other
hand forgot some of the current ones.
Also, add a missing ) in a warning (introduced and fixed by Sam Ravnborg ;)
|
|
If you hide the sub-make in a function, 'make' needs a little help...
|
|
We don't descend anymore when building vmlinux, so don't do so for
the i386 specific boot targets, either.
Plus, more cleanup in arch/i386/Makefile
|
|
Improve the warning messages when using obsolete features, kill one
remaining user of $(list-multi)
(by Sam Ravnborg)
I also made O_TARGET != built-in.o an error, since compatibility code for
that case has already been dropped
|
|
Sam Ravnborg missed a place I missed converting, and I found another one,
too.
|
|
Instead of using make -C <subdir>, just use make -f <subdir>/Makefile.
This means we now call gcc/ld/... always from the topdir.
Advantages are:
o We don't need to use -I$(TOPDIR)/include and the like, just
-Iinclude works.
o __FILE__ gives the correct relative path from the topdir instead
of an absolute path, as it did before for included headers
o gcc errors/warnings give the correct relative path from the topdir
o takes us a step closer to a non-recursive build (though that's probably
as close as it gets)
The changes to Rules.make were done in a way which only uses the new way
for the standard recursive build (which remains recursive, just without
cd), all the archs do make -C arch/$(ARCH)/boot ..., which should keep
working as before. However, of course this should be converted eventually,
it's possible to do so piecemeal arch by arch.
It seems to work fine for most of the standard kernel. Potential places
which need changing are added -I flags to the command line, which now
need to have the path relative to the topdir and explicit rules for
generating files, which need to properly use $(obj) / $(src) to work
correctly.
|
|
Makefiles which still use obsolete 2.4 constructs now give a warning.
|
|
xfs.o is built as one modules out of objects distributed into
multiple subdirs. That is okay with the current kbuild, you just
have to include the path for objects which reside in a subdir, then.
xfs used vpath instead of explicitly adding the paths, which is
inconsistent and conflicts e.g. with proper module version generation.
|
|
o Use a function "descend" for descending into subdirectories
o Remove unused (?) "boot" target
o Remove unnecessary intermediate "sub_dirs" target from Rules.make
o Use /bin/true instead of echo -n to suppress spurious
"nothing to be done for ..." output from make
|
|
|
|
(slightly modified to unconditionally add the relative path to the subdir)
Rusty Russel wrote:
"M-x compile" in emacs stars a compilation and can jump to the next
error. With KBUILD_VERSBOSE=0 (as I have in my env, great work Kai)
it can't figure out the directory, since it doesn't see the make[XXX]
markers.
This makes it work.
|
|
When using cp to copy the shipped file to its actual name,
permissions would be preserved, particularly the copy would be
read-only when the original was (BitKeeper) read-only, leading
to an error when executing the rule a second time.
So now we use cat, which will generate a writable file.
|
|
Just some cosmetical changes to align output in non-verbose mode.
|
|
do_cmd is a nice shorthand when creating rules that in one line
shall adhere to KBUILD_VERBOSE and make -s.
So far the only user is (will be) the docbook makefile
|
|
Some archs sneaked additional flags for ld into $(LD). This can be done
cleaner now, by just using $(LDFLAGS).
|
|
o Provide $(obj),$(objtree) and friends in the top-level Makefile as well
for consistency (Sam Ravnborg)
o Make $(call cmd,whatever) consistent with $(call if_changed,whatever),
i.e. both will execute $(cmd_whatever)
o Add $(echo_target), which will print the current target in a suitable
way for the quiet output format (i.e. target name relative to the
top-level directory)
o Fix the dependencies for host compiled programs to work for files in
subdirectories (missed converting them when introducing $(depfile))
o Add commands which will be useful when generating boot images.
|
|
To generate the module versions for 53c700.o, we need the included
generated header already.
Improve the rule to copy shipped files into place.
|
|
For separate source and object directories, Rules.make needs
to know where the files live.
For all the normal variables, $(obj-[ymn]) etc, it can figure that
out by itself, but for explicit rules to generate files it needs
help.
So there $(obj)/target.o indicates that this file lives in the
object directory, as opposed to $(src)/target.c, which lives in
the source dir.
For now $(obj) = $(src) = ., but convert some Makefiles to it
already.
|
|
Rename the shipped 53c.. firmware files to <name>_shipped.
Add a default rule for shipped files, which will just
call <name>_shipped to <name> if no specific rule to generate
the target exists.
Rename the aic7xxx firmware to fit into this naming scheme.
For now 53c... defaults to just using the shipped firmware.
|
|
Reduce the amount of output in verbose (default) mode and stop
immediately on error.
(Sam Ravnborg/me)
|
|
New and old way to handle dependencies would choke when a file
#include'd by other files was removed, since the dependency on it was
still recorded, but since it was gone, make has no idea what to do about
it (and would complain with "No rule to make <file> ...")
We now add targets for all the previously included files, so make will
just ignore them if they disappear.
|
|
As pointed out by Mikael Pettersson, we didn't generate checksums for
all exporting objects, due to a thinko of mine.
|
|
When compiling a host program directly from the source without
going via intermediate objects, we were missing $(HOST_LOADLIBES) on
the command line.
Pointed out by Keith Owens.
|
|
The dependency generation broke on files with a comma in their name,
i.e. 53c7,8xx.c
This patches fixes the limitation. However, using commas in filenames
is strongly discouraged, there are other places where this case cannot
be handled cleanly (e.g. section names in include/linux/spinlock.h).
|
|
by Sam Ravnborg
|
|
Tracking dependencies for .ver files isn't really different from
the dependency tracking for the other .[ois] targets we do,
so just use the normal $(call if_changed_dep) framework. That makes
speeds up re-running "make dep" a lot.
|
|
Up to now, we generated module versions for all objects which
were listed in $(export-objs).
This had one advantage: A changed .config will not affect which
.ver files are built, thus saving recompiles.
However, it is fundamentally broken. To build .ver files, we preprocess
the exporting sources - and the result can obviously depend on
the current .config. Even worse, some files generate errors when
preprocessed with the wrong .config - it doesn't matter a lot that
drivers/sbus/* will generate errors on x86, since it won't be used anyway,
but e.g. kernel/suspend.c cannot be preprocessed unless
CONFIG_SOFTWARE_SUSPEND is set. - Up to now, we just silently ignore
these errors.
Actually, the whole point behind CONFIG_MODVERSIONS is to make sure
we don't insert modules into a kernel which was configured differently,
and as such the generation of symbols can only work when .config is
known.
So we now only generate symbols for objects which will actually be
compiled - which means less work, and enforce the kernel to be configured
before "make dep".
|
|
Keep track of possible targets while we add rules - Later, only
include the command lines / dependencies as needed.
E.g., when defining how to build multi-part objects listed in
$(multi-used-y) and $(multi-used-m), add $(multi-used-y,m) to
the variable targets. At the end of Rules.make, we then include
the saved command lines for these targets (if they exist), needed
to check whether the command changed and we hence need to rebuild.
|
|
Previously, we always had put the .cmd/.d files into the local subdir
- now we put them into the directory where the target lives, like
some/dir/target.o <-> some/dir/.target.o.cmd
It does not yet make a difference, since we always only generated
targets in the local directory anyway, but that will change with
tracking dependencies for .ver files.
|
|
We use A/CFLAGS_KERNEL by default anyway, so no need to set them
explicitly for built-in objects.
|
|
This patch doesn't change anything but the order (and some comments) in
Rules.make. The reason for that is that we use Rules.make for three
different purposes, fastdep, modules_install and the actual building.
As an example, we don't need all the dependencies and saved command lines
when installing modules, so it'll speed up this pass to only include the
rules which will actually get used.
|
|
So far, we had been lazy and not generated dependencies for
debugging-only targets, like some/dir/foo.[is]. It actually
cleans up Rules.make to handle them by the same mechanism, though.
Additionally, make use of $(call if_changed) and $(call if_changed_dep)
more consistent, the only difference now is post-processing of
gcc -MD output, which is done for if_changed_dep but not for if_changed.
|
|
cpp -MD guesses the target name from the source file name, but not
always correctly, e.g. when compiling fixdep, it generates prequisites
for fixdep.o instead of fixdep.
fixdep now fixes up the -MD generated output to contain the right target,
which is the one we pass on the command line.
|
|
o When using "make -j<n>", the order in modversions.h could change,
thus causing unnecessary rebuilds.
o Move a comment in Rules.make which I forgot when I moved the
associated code.
o When descending into init/ during the final vmlinux link,
add a '+' do tell make to use its normal "-j" jobserver handling.
o It'd be nice to get the logic between make clean and make mrproper
clearer. I think make clean should remove all targets used in the
actual build,
make mrproper should remove the rest, build-specific files, like
e.g. the .*.cmd files used to save dependencies and command lines
and other temporary files.
A real small step in the direction: Remove .tmpversion/.tmp-export-objs
at mrproper time.
|
|
o Fix a bug in fixdep.c, which could cause segfaults
o Make sure that we build fixdep first of all, since
we need it to build host programs.
|
|
At a couple of places, we need to build programs which run on the
compile host during building the kernel.
Add a new variable "host-progs" to declare such programs. Rules.make will
automatically provide rules to compile these programs with appropriate
command lines etc.
Compared to having explicit rules spread around for doing so, this has
the following advantages:
o shorter
o automatically figures out dependencies and handles changing command
lines
o Nicer output in quiet mode ;-)
Compiling host programs from multiple sources is also possible, analogous
to multi-part objects. E.g. scripts/Makefile has
host-progs := tkparse
tkparse-objs := tkparse.o tkcond.o tkgen.o
|
|
Kernel code should not include userspace headers. To avoid that
happening by mistake, ask gcc not to look into the usual places
when looking for headers. We still need to find gcc headers for
vararg and similar, though - achieved by the "-iwithprefix include"
which will look into <gcc-path>/include, as proposed by Russell
King.
A similar patch went into 2.4, so not much breakage expected.
|
|
So here we are: make vmlinux/bzImage/whatever will now also build
modules as it goes. Other than that, everything works as usual.
"make modules" builds only the modules (but you shouldn't need
it anymore). If you don't want the modules built, you can
do "make KBUILD_MODULES= vmlinux/whatever" to only compile built-in
objects.
If people want it, I can also allow for "make vmlinux/whatever nomodules"
to do the same.
Also, add ' ' in Rules.make to properly align output in quiet mode.
|
|
If an object was changed to not export symbols anymore, the
corresponding stale .ver file would have been left lying around
and been picked up when generating modversions.h.
The obvious solution to remove include/linux/modules/* at the
beginning of "make dep" is not really good, since that means
that .ver files would be regenerated unconditionally, thus causing
a lot of possibly unnecessary rebuilds.
So, instead, we build a temporary shadow tree of all export-objs
(as empty files) during the recursive "make fastdep" phase, and use
that to generate modversions.h.
Ensure that we touch include/linux/modversions.h if any of the
.ver files changes, that's our marker to rebuild all modversions
affected files.
|