Commit 161558fd authored by Kai Germaschewski's avatar Kai Germaschewski

Merge http://linux-isdn.bkbits.net/linux-2.5.make

into tp1.ruhr-uni-bochum.de:/home/kai/kernel/v2.5/linux-2.5.make
parents f0c518a9 a95ca5a9
......@@ -145,7 +145,8 @@ ifeq ($(filter $(noconfig_targets),$(MAKECMDGOALS)),)
.config:
@echo '***'
@echo '*** You have not yet configured your kernel!'
@echo '*** Please run "make xconfig/menuconfig/config/oldconfig"'
@echo '*** Please run some configurator (do "make xconfig" or'
@echo '*** "make menuconfig" or "make oldconfig" or "make config").'
@echo '***'
@exit 1
......@@ -478,6 +479,8 @@ rpm: clean spec
else # ifeq ($(filter $(noconfig_targets),$(MAKECMDGOALS)),)
ifeq ($(filter-out $(noconfig_targets),$(MAKECMDGOALS)),)
# Targets which don't need .config
# ===========================================================================
#
......@@ -536,23 +539,6 @@ allmodconfig:
defconfig:
yes '' | $(CONFIG_SHELL) scripts/Configure -d arch/$(ARCH)/config.in
# How we generate .config depends on which *config the
# user chose when calling make
.config: $(filter oldconfig xconfig menuconfig config,$(MAKECMDGOALS)) ;
# If the user gave commands from both the need / need not
# .config sections, we need to call make again after
# .config is generated, now to take care of the remaining
# targets we know nothing about in this section
remaining_targets := $(filter-out $(noconfig_targets),$(MAKECMDGOALS))
$(remaining_targets) : make_with_config
make_with_config: .config
@$(MAKE) $(remaining_targets)
# Cleaning up
# ---------------------------------------------------------------------------
......@@ -621,7 +607,8 @@ clean: archclean
mrproper: clean archmrproper
@echo 'Making mrproper'
@find . \( -size 0 -o -name .depend \) -type f -print | xargs rm -f
@find . \( -size 0 -o -name .depend -o -name .\*.cmd \) \
-type f -print | xargs rm -f
@rm -f $(MRPROPER_FILES)
@rm -rf $(MRPROPER_DIRS)
@$(MAKE) -C Documentation/DocBook mrproper
......@@ -656,8 +643,6 @@ sgmldocs psdocs pdfdocs htmldocs:
@$(MAKE) -C Documentation/DocBook $@
endif # ifeq ($(filter $(noconfig_targets),$(MAKECMDGOALS)),)
# Scripts to check various things for consistency
# ---------------------------------------------------------------------------
......@@ -670,6 +655,18 @@ checkhelp:
checkincludes:
find * -name '*.[hcS]' -type f -print | sort | xargs $(PERL) -w scripts/checkincludes.pl
else # ifneq ($(filter-out $(noconfig_targets),$(MAKECMDGOALS)),)
# We're called with both targets which do and do not need
# .config included. Handle them one after the other.
# ===========================================================================
%:: FORCE
$(MAKE) $@
endif # ifeq ($(filter-out $(noconfig_targets),$(MAKECMDGOALS)),)
endif # ifeq ($(filter $(noconfig_targets),$(MAKECMDGOALS)),)
# FIXME Should go into a make.lib or something
# ===========================================================================
......
......@@ -131,9 +131,13 @@ else
genksyms_smp_prefix :=
endif
$(MODVERDIR)/$(real-objs-y:.o=.ver): modkern_cflags := $(CFLAGS_KERNEL)
$(MODVERDIR)/$(real-objs-m:.o=.ver): modkern_cflags := $(CFLAGS_MODULE)
$(MODVERDIR)/$(export-objs:.o=.ver): export_flags := -D__GENKSYMS__
# Don't include modversions.h, we're just about to generate it here.
CFLAGS_MODULE := $(filter-out -include $(HPATH)/linux/modversions.h,$(CFLAGS_MODULE))
$(addprefix $(MODVERDIR)/,$(real-objs-y:.o=.ver)): modkern_cflags := $(CFLAGS_KERNEL)
$(addprefix $(MODVERDIR)/,$(real-objs-m:.o=.ver)): modkern_cflags := $(CFLAGS_MODULE)
$(addprefix $(MODVERDIR)/,$(export-objs:.o=.ver)): export_flags := -D__GENKSYMS__
c_flags = -Wp,-MD,$(depfile) $(CFLAGS) $(NOSTDINC_FLAGS) \
$(modkern_cflags) $(EXTRA_CFLAGS) $(CFLAGS_$(*F).o) \
......@@ -145,18 +149,34 @@ c_flags = -Wp,-MD,$(depfile) $(CFLAGS) $(NOSTDINC_FLAGS) \
# files changes
quiet_cmd_cc_ver_c = MKVER include/linux/modules/$(RELDIR)/$*.ver
define cmd_cc_ver_c
mkdir -p $(dir $@); \
$(CPP) $(c_flags) $< | $(GENKSYMS) $(genksyms_smp_prefix) \
-k $(VERSION).$(PATCHLEVEL).$(SUBLEVEL) > $@.tmp; \
cmd_cc_ver_c = $(CPP) $(c_flags) $< | $(GENKSYMS) $(genksyms_smp_prefix) \
-k $(VERSION).$(PATCHLEVEL).$(SUBLEVEL) > $@.tmp
# Okay, let's explain what's happening in rule_make_cc_ver_c:
# o echo the command
# o execute the command
# o If the $(CPP) fails, we won't notice because it's output is piped
# to $(GENKSYMS) which does not fail. We recognize this case by
# looking if the generated $(depfile) exists, though.
# o If the .ver file changed, touch modversions.h, which is our maker
# of any changed .ver files.
# o Move command line and deps into their normal .*.cmd place.
define rule_cc_ver_c
$(if $($(quiet)cmd_cc_ver_c),echo ' $($(quiet)cmd_cc_ver_c)';) \
$(cmd_cc_ver_c); \
if [ ! -r $(depfile) ]; then exit 1; fi; \
$(TOPDIR)/scripts/fixdep $(depfile) $@ $(TOPDIR) '$(cmd_cc_ver_c)' > $(@D)/.$(@F).tmp; \
rm -f $(depfile); \
if [ ! -r $@ ] || cmp -s $@ $@.tmp; then \
touch $(TOPDIR)/include/linux/modversions.h; \
fi; \
mv -f $@.tmp $@
mv -f $(@D)/.$(@F).tmp $(@D)/.$(@F).cmd
endef
$(MODVERDIR)/%.ver: %.c FORCE
@$(call if_changed_dep,cc_ver_c)
@$(call if_changed_rule,cc_ver_c)
targets := $(addprefix $(MODVERDIR)/,$(export-objs:.o=.ver))
......@@ -446,7 +466,7 @@ if_changed = $(if $(strip $? \
# execute the command and also postprocess generated .d dependencies
# file
if_changed_dep = $(if $(strip $? \
if_changed_dep = $(if $(strip $? $(filter-out FORCE $(wildcard $^),$^)\
$(filter-out $(cmd_$(1)),$(cmd_$@))\
$(filter-out $(cmd_$@),$(cmd_$(1)))),\
@set -e; \
......@@ -456,6 +476,17 @@ if_changed_dep = $(if $(strip $? \
rm -f $(depfile); \
mv -f $(@D)/.$(@F).tmp $(@D)/.$(@F).cmd)
# Usage: $(call if_changed_rule,foo)
# will check if $(cmd_foo) changed, or any of the prequisites changed,
# and if so will execute $(rule_foo)
if_changed_rule = $(if $(strip $? \
$(filter-out $(cmd_$(1)),$(cmd_$@))\
$(filter-out $(cmd_$@),$(cmd_$(1)))),\
@set -e; \
mkdir -p $(dir $@); \
$(rule_$(1)))
# If quiet is set, only print short version of command
cmd = @$(if $($(quiet)$(1)),echo ' $($(quiet)$(1))' &&) $($(1))
......@@ -143,7 +143,7 @@ void grow_config(int len)
size_config = 2048;
str_config = realloc(str_config, size_config *= 2);
if (str_config == NULL)
{ perror("malloc"); exit(1); }
{ perror("fixdep:malloc"); exit(1); }
}
}
......@@ -259,6 +259,7 @@ void do_config_file(char *filename)
fd = open(filename, O_RDONLY);
if (fd < 0) {
fprintf(stderr, "fixdep: ");
perror(filename);
exit(2);
}
......@@ -269,7 +270,7 @@ void do_config_file(char *filename)
}
map = mmap(NULL, st.st_size, PROT_READ, MAP_PRIVATE, fd, 0);
if ((long) map == -1) {
perror("mmap");
perror("fixdep: mmap");
close(fd);
return;
}
......@@ -292,7 +293,7 @@ void parse_dep_file(void *map, size_t len)
exit(1);
}
memcpy(s, m, p-m); s[p-m] = 0;
printf("%s: \\\n", target);
printf("deps_%s := \\\n", target);
m = p+1;
clear_config();
......@@ -314,7 +315,8 @@ void parse_dep_file(void *map, size_t len)
}
m = p + 1;
}
printf("\n");
printf("\n%s: $(deps_%s)\n\n", target, target);
printf("$(deps_%s):\n", target);
}
void print_deps(void)
......@@ -325,6 +327,7 @@ void print_deps(void)
fd = open(depfile, O_RDONLY);
if (fd < 0) {
fprintf(stderr, "fixdep: ");
perror(depfile);
exit(2);
}
......@@ -336,7 +339,7 @@ void print_deps(void)
}
map = mmap(NULL, st.st_size, PROT_READ, MAP_PRIVATE, fd, 0);
if ((long) map == -1) {
perror("mmap");
perror("fixdep: mmap");
close(fd);
return;
}
......
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