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)),) ...@@ -145,7 +145,8 @@ ifeq ($(filter $(noconfig_targets),$(MAKECMDGOALS)),)
.config: .config:
@echo '***' @echo '***'
@echo '*** You have not yet configured your kernel!' @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 '***' @echo '***'
@exit 1 @exit 1
...@@ -478,6 +479,8 @@ rpm: clean spec ...@@ -478,6 +479,8 @@ rpm: clean spec
else # ifeq ($(filter $(noconfig_targets),$(MAKECMDGOALS)),) else # ifeq ($(filter $(noconfig_targets),$(MAKECMDGOALS)),)
ifeq ($(filter-out $(noconfig_targets),$(MAKECMDGOALS)),)
# Targets which don't need .config # Targets which don't need .config
# =========================================================================== # ===========================================================================
# #
...@@ -536,23 +539,6 @@ allmodconfig: ...@@ -536,23 +539,6 @@ allmodconfig:
defconfig: defconfig:
yes '' | $(CONFIG_SHELL) scripts/Configure -d arch/$(ARCH)/config.in 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 # Cleaning up
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
...@@ -621,7 +607,8 @@ clean: archclean ...@@ -621,7 +607,8 @@ clean: archclean
mrproper: clean archmrproper mrproper: clean archmrproper
@echo 'Making mrproper' @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 -f $(MRPROPER_FILES)
@rm -rf $(MRPROPER_DIRS) @rm -rf $(MRPROPER_DIRS)
@$(MAKE) -C Documentation/DocBook mrproper @$(MAKE) -C Documentation/DocBook mrproper
...@@ -656,8 +643,6 @@ sgmldocs psdocs pdfdocs htmldocs: ...@@ -656,8 +643,6 @@ sgmldocs psdocs pdfdocs htmldocs:
@$(MAKE) -C Documentation/DocBook $@ @$(MAKE) -C Documentation/DocBook $@
endif # ifeq ($(filter $(noconfig_targets),$(MAKECMDGOALS)),)
# Scripts to check various things for consistency # Scripts to check various things for consistency
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
...@@ -670,6 +655,18 @@ checkhelp: ...@@ -670,6 +655,18 @@ checkhelp:
checkincludes: checkincludes:
find * -name '*.[hcS]' -type f -print | sort | xargs $(PERL) -w scripts/checkincludes.pl 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 # FIXME Should go into a make.lib or something
# =========================================================================== # ===========================================================================
......
...@@ -131,9 +131,13 @@ else ...@@ -131,9 +131,13 @@ else
genksyms_smp_prefix := genksyms_smp_prefix :=
endif endif
$(MODVERDIR)/$(real-objs-y:.o=.ver): modkern_cflags := $(CFLAGS_KERNEL) # Don't include modversions.h, we're just about to generate it here.
$(MODVERDIR)/$(real-objs-m:.o=.ver): modkern_cflags := $(CFLAGS_MODULE)
$(MODVERDIR)/$(export-objs:.o=.ver): export_flags := -D__GENKSYMS__ 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) \ c_flags = -Wp,-MD,$(depfile) $(CFLAGS) $(NOSTDINC_FLAGS) \
$(modkern_cflags) $(EXTRA_CFLAGS) $(CFLAGS_$(*F).o) \ $(modkern_cflags) $(EXTRA_CFLAGS) $(CFLAGS_$(*F).o) \
...@@ -145,18 +149,34 @@ c_flags = -Wp,-MD,$(depfile) $(CFLAGS) $(NOSTDINC_FLAGS) \ ...@@ -145,18 +149,34 @@ c_flags = -Wp,-MD,$(depfile) $(CFLAGS) $(NOSTDINC_FLAGS) \
# files changes # files changes
quiet_cmd_cc_ver_c = MKVER include/linux/modules/$(RELDIR)/$*.ver quiet_cmd_cc_ver_c = MKVER include/linux/modules/$(RELDIR)/$*.ver
define cmd_cc_ver_c cmd_cc_ver_c = $(CPP) $(c_flags) $< | $(GENKSYMS) $(genksyms_smp_prefix) \
mkdir -p $(dir $@); \ -k $(VERSION).$(PATCHLEVEL).$(SUBLEVEL) > $@.tmp
$(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 \ if [ ! -r $@ ] || cmp -s $@ $@.tmp; then \
touch $(TOPDIR)/include/linux/modversions.h; \ touch $(TOPDIR)/include/linux/modversions.h; \
fi; \ fi; \
mv -f $@.tmp $@ mv -f $@.tmp $@
mv -f $(@D)/.$(@F).tmp $(@D)/.$(@F).cmd
endef endef
$(MODVERDIR)/%.ver: %.c FORCE $(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)) targets := $(addprefix $(MODVERDIR)/,$(export-objs:.o=.ver))
...@@ -446,7 +466,7 @@ if_changed = $(if $(strip $? \ ...@@ -446,7 +466,7 @@ if_changed = $(if $(strip $? \
# execute the command and also postprocess generated .d dependencies # execute the command and also postprocess generated .d dependencies
# file # file
if_changed_dep = $(if $(strip $? \ if_changed_dep = $(if $(strip $? $(filter-out FORCE $(wildcard $^),$^)\
$(filter-out $(cmd_$(1)),$(cmd_$@))\ $(filter-out $(cmd_$(1)),$(cmd_$@))\
$(filter-out $(cmd_$@),$(cmd_$(1)))),\ $(filter-out $(cmd_$@),$(cmd_$(1)))),\
@set -e; \ @set -e; \
...@@ -456,6 +476,17 @@ if_changed_dep = $(if $(strip $? \ ...@@ -456,6 +476,17 @@ if_changed_dep = $(if $(strip $? \
rm -f $(depfile); \ rm -f $(depfile); \
mv -f $(@D)/.$(@F).tmp $(@D)/.$(@F).cmd) 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 # If quiet is set, only print short version of command
cmd = @$(if $($(quiet)$(1)),echo ' $($(quiet)$(1))' &&) $($(1)) cmd = @$(if $($(quiet)$(1)),echo ' $($(quiet)$(1))' &&) $($(1))
...@@ -143,7 +143,7 @@ void grow_config(int len) ...@@ -143,7 +143,7 @@ void grow_config(int len)
size_config = 2048; size_config = 2048;
str_config = realloc(str_config, size_config *= 2); str_config = realloc(str_config, size_config *= 2);
if (str_config == NULL) if (str_config == NULL)
{ perror("malloc"); exit(1); } { perror("fixdep:malloc"); exit(1); }
} }
} }
...@@ -259,6 +259,7 @@ void do_config_file(char *filename) ...@@ -259,6 +259,7 @@ void do_config_file(char *filename)
fd = open(filename, O_RDONLY); fd = open(filename, O_RDONLY);
if (fd < 0) { if (fd < 0) {
fprintf(stderr, "fixdep: ");
perror(filename); perror(filename);
exit(2); exit(2);
} }
...@@ -269,7 +270,7 @@ void do_config_file(char *filename) ...@@ -269,7 +270,7 @@ void do_config_file(char *filename)
} }
map = mmap(NULL, st.st_size, PROT_READ, MAP_PRIVATE, fd, 0); map = mmap(NULL, st.st_size, PROT_READ, MAP_PRIVATE, fd, 0);
if ((long) map == -1) { if ((long) map == -1) {
perror("mmap"); perror("fixdep: mmap");
close(fd); close(fd);
return; return;
} }
...@@ -292,7 +293,7 @@ void parse_dep_file(void *map, size_t len) ...@@ -292,7 +293,7 @@ void parse_dep_file(void *map, size_t len)
exit(1); exit(1);
} }
memcpy(s, m, p-m); s[p-m] = 0; memcpy(s, m, p-m); s[p-m] = 0;
printf("%s: \\\n", target); printf("deps_%s := \\\n", target);
m = p+1; m = p+1;
clear_config(); clear_config();
...@@ -314,7 +315,8 @@ void parse_dep_file(void *map, size_t len) ...@@ -314,7 +315,8 @@ void parse_dep_file(void *map, size_t len)
} }
m = p + 1; m = p + 1;
} }
printf("\n"); printf("\n%s: $(deps_%s)\n\n", target, target);
printf("$(deps_%s):\n", target);
} }
void print_deps(void) void print_deps(void)
...@@ -325,6 +327,7 @@ void print_deps(void) ...@@ -325,6 +327,7 @@ void print_deps(void)
fd = open(depfile, O_RDONLY); fd = open(depfile, O_RDONLY);
if (fd < 0) { if (fd < 0) {
fprintf(stderr, "fixdep: ");
perror(depfile); perror(depfile);
exit(2); exit(2);
} }
...@@ -336,7 +339,7 @@ void print_deps(void) ...@@ -336,7 +339,7 @@ void print_deps(void)
} }
map = mmap(NULL, st.st_size, PROT_READ, MAP_PRIVATE, fd, 0); map = mmap(NULL, st.st_size, PROT_READ, MAP_PRIVATE, fd, 0);
if ((long) map == -1) { if ((long) map == -1) {
perror("mmap"); perror("fixdep: mmap");
close(fd); close(fd);
return; 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