Commit 5674ceba authored by Kai Germaschewski's avatar Kai Germaschewski

kbuild: Standardize building of init/*

There's no good reason to build the objects in init/ explicitly from
the top-level Makefile. Instead, handle init/ like every other
subdir, which also provides the automatic checks for a changed
command line etc.
parent bd2b0c85
......@@ -55,8 +55,7 @@ all: do-it-all
ifeq (.config,$(wildcard .config))
include .config
ifeq (.depend,$(wildcard .depend))
include .depend
ifeq (.hdepend,$(wildcard .hdepend))
do-it-all: vmlinux
else
CONFIGURATION = depend
......@@ -93,11 +92,12 @@ CFLAGS := $(CPPFLAGS) -Wall -Wstrict-prototypes -Wno-trigraphs -O2 \
-fomit-frame-pointer -fno-strict-aliasing -fno-common
AFLAGS := -D__ASSEMBLY__ $(CPPFLAGS)
INIT =init/init.o
CORE_FILES =kernel/kernel.o mm/mm.o fs/fs.o ipc/ipc.o
NETWORKS =net/network.o
LIBS =$(TOPDIR)/lib/lib.a
SUBDIRS =kernel lib drivers mm fs net ipc sound
SUBDIRS =init kernel lib drivers mm fs net ipc sound
DRIVERS-n :=
DRIVERS-y :=
......@@ -165,8 +165,8 @@ export NETWORKS DRIVERS LIBS HEAD LDFLAGS LINKFLAGS MAKEBOOT ASFLAGS
boot: vmlinux
@$(MAKE) CFLAGS="$(CFLAGS) $(CFLAGS_KERNEL)" AFLAGS="$(AFLAGS) $(AFLAGS_KERNEL)" -C arch/$(ARCH)/boot
vmlinux: include/linux/version.h $(CONFIGURATION) init/main.o init/version.o init/do_mounts.o linuxsubdirs
$(LD) $(LINKFLAGS) $(HEAD) init/main.o init/version.o init/do_mounts.o \
vmlinux: include/linux/version.h $(CONFIGURATION) linuxsubdirs
$(LD) $(LINKFLAGS) $(HEAD) $(INIT) \
--start-group \
$(CORE_FILES) \
$(LIBS) \
......@@ -220,11 +220,6 @@ include/config/MARKER: scripts/split-include include/linux/autoconf.h
# Generate some files
$(TOPDIR)/include/linux/version.h: include/linux/version.h
$(TOPDIR)/include/linux/compile.h: include/linux/compile.h
include/linux/compile.h: $(CONFIGURATION) include/linux/version.h
@echo Generating $@
@. scripts/mkcompile_h $@ "$(ARCH)" "$(CONFIG_SMP)" "$(CC) $(CFLAGS)"
include/linux/version.h: ./Makefile
@echo Generating $@
......@@ -232,26 +227,12 @@ include/linux/version.h: ./Makefile
comma := ,
# ---------------------------------------------------------------------------
# Build files in init
# FIXME should be moved to init/Makefile
init/version.o: init/version.c include/linux/compile.h include/config/MARKER
$(CC) $(CFLAGS) $(CFLAGS_KERNEL) -DKBUILD_BASENAME=$(subst $(comma),_,$(subst -,_,$(*F))) -c -o init/version.o init/version.c
init/main.o: init/main.c include/config/MARKER
$(CC) $(CFLAGS) $(CFLAGS_KERNEL) $(PROFILING) -DKBUILD_BASENAME=$(subst $(comma),_,$(subst -,_,$(*F))) -c -o $*.o $<
init/do_mounts.o: init/do_mounts.c include/config/MARKER
$(CC) $(CFLAGS) $(CFLAGS_KERNEL) $(PROFILING) -DKBUILD_BASENAME=$(subst $(comma),_,$(subst -,_,$(*F))) -c -o $*.o $<
# ---------------------------------------------------------------------------
# Generate dependencies
depend dep: dep-files
dep-files: scripts/mkdep archdep include/linux/version.h
scripts/mkdep -- init/*.c > .depend
scripts/mkdep -- `find $(FINDHPATH) -name SCCS -prune -o -follow -name \*.h ! -name modversions.h -print` > .hdepend
$(MAKE) $(patsubst %,_sfdep_%,$(SUBDIRS)) _FASTDEP_ALL_SUB_DIRS="$(SUBDIRS)"
ifdef CONFIG_MODVERSIONS
......@@ -487,4 +468,3 @@ backup: mrproper
sums:
find . -type f -print | sort | xargs sum > .SUMS
#
# Makefile for the linux kernel.
#
O_TARGET := init.o
obj-y := main.o version.o do_mounts.o
include $(TOPDIR)/Rules.make
# dependencies on generated files need to be listed explicitly
version.o: ../include/linux/compile.h
# compile.h changes depending on hostname, generation number, etc,
# so we regenerate it always.
# mkcompile_h will make sure to only update the
# actualy file if its content has changed.
../include/linux/compile.h: ../include/linux/version.h dummy
@echo Generating $@
@. ../scripts/mkcompile_h $@ "$(ARCH)" "$(CONFIG_SMP)" "$(CC) $(CFLAGS)"
......@@ -5,11 +5,11 @@ CC=$4
# Generate a temporary compile.h
( echo /\* This file is auto generated, version `cat .version` \*/
( echo /\* This file is auto generated, version `cat ../.version` \*/
echo \#define UTS_MACHINE \"$ARCH\"
echo -n \#define UTS_VERSION \"\#`cat .version`
echo -n \#define UTS_VERSION \"\#`cat ../.version`
if [ -n "$SMP" ] ; then echo -n " SMP"; fi
echo ' '`date`'"'
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment