URL
https://opencores.org/ocsvn/or1k/or1k/trunk
Subversion Repositories or1k
[/] [or1k/] [trunk/] [uclinux/] [uClinux-2.0.x/] [Rules.make] - Rev 1765
Compare with Previous | Blame | View Log
## This file contains rules which are shared between multiple Makefiles.### False targets.#.PHONY: dummy## Special variables which should not be exported#unexport EXTRA_ASFLAGSunexport EXTRA_CFLAGSunexport EXTRA_LDFLAGSunexport EXTRA_ARFLAGSunexport SUBDIRSunexport SUB_DIRSunexport ALL_SUB_DIRSunexport MOD_SUB_DIRSunexport O_TARGETunexport O_OBJSunexport L_OBJSunexport M_OBJSunexport MI_OBJSunexport ALL_MOBJS# objects that export symbol tablesunexport OX_OBJSunexport LX_OBJSunexport MX_OBJSunexport MIX_OBJSunexport SYMTAB_OBJSunexport MOD_LIST_NAME## Get things started.#first_rule: sub_dirs$(MAKE) all_targets## Common rules#%.s: %.c$(CC) $(CFLAGS) $(EXTRA_CFLAGS) -S $< -o $@%.o: %.c$(CC) $(CFLAGS) $(EXTRA_CFLAGS) -c -o $@ $<%.o: %.s$(AS) $(ASFLAGS) $(EXTRA_CFLAGS) -o $@ $<###all_targets: $(O_TARGET) $(L_TARGET)## Rule to compile a set of .o files into one .o file#ifdef O_TARGETALL_O = $(OX_OBJS) $(O_OBJS)$(O_TARGET): $(ALL_O) $(TOPDIR)/include/linux/config.hrm -f $@ifneq "$(strip $(ALL_O))" ""$(LD) $(EXTRA_LDFLAGS) -r -o $@ $(ALL_O)else$(AR) rcs $@endifendif## Rule to compile a set of .o files into one .a file#ifdef L_TARGET$(L_TARGET): $(LX_OBJS) $(L_OBJS) $(TOPDIR)/include/linux/config.hrm -f $@$(AR) $(EXTRA_ARFLAGS) rcs $@ $(LX_OBJS) $(L_OBJS)endif## This make dependencies quickly#fastdep: dummyif [ -n "$(wildcard *.[chS])" ]; then \$(TOPDIR)/scripts/mkdep *.[chS] > .depend; fiifdef ALL_SUB_DIRSset -e; for i in $(ALL_SUB_DIRS); do $(MAKE) -C $$i fastdep; doneendif## A rule to make subdirectories#sub_dirs: dummyifdef SUB_DIRSset -e; for i in $(SUB_DIRS); do $(MAKE) -C $$i; doneendif## A rule to make modules#ALL_MOBJS = $(MX_OBJS) $(M_OBJS)ifneq "$(strip $(ALL_MOBJS))" ""PDWN=$(shell $(CONFIG_SHELL) $(TOPDIR)/scripts/pathdown.sh)endifmodules: $(ALL_MOBJS) $(MIX_OBJS) $(MI_OBJS) dummyifdef MOD_SUB_DIRSset -e; for i in $(MOD_SUB_DIRS); do $(MAKE) -C $$i modules; doneendififneq "$(strip $(MOD_LIST_NAME))" ""rm -f $$TOPDIR/modules/$(MOD_LIST_NAME)ifdef MOD_SUB_DIRSfor i in $(MOD_SUB_DIRS); do \echo `basename $$i`.o >> $$TOPDIR/modules/$(MOD_LIST_NAME); doneendififneq "$(strip $(ALL_MOBJS))" ""echo $(ALL_MOBJS) >> $$TOPDIR/modules/$(MOD_LIST_NAME)endifendififneq "$(strip $(ALL_MOBJS))" ""echo $(PDWN)cd $$TOPDIR/modules; for i in $(ALL_MOBJS); do \ln -sf ../$(PDWN)/$$i .; doneendif## A rule to do nothing#dummy:## This is useful for testing#script:$(SCRIPT)## This sets version suffixes on exported symbols# Uses SYMTAB_OBJS# Separate the object into "normal" objects and "exporting" objects# Exporting objects are: all objects that define symbol tables#ifdef CONFIG_MODVERSIONSSYMTAB_OBJS = $(LX_OBJS) $(OX_OBJS) $(MX_OBJS) $(MIX_OBJS)ifneq "$(strip $(SYMTAB_OBJS))" ""MODINCL = $(TOPDIR)/include/linux/modules# The -w option (enable warnings) for /bin/genksyms will return here in 2.1$(MODINCL)/%.ver: %.c@if [ ! -x /sbin/genksyms ]; then echo "Please read: Documentation/modules.txt"; fi$(CC) $(CFLAGS) -E -D__GENKSYMS__ $< | /sbin/genksyms $(MODINCL)$(addprefix $(MODINCL)/,$(SYMTAB_OBJS:.o=.ver)): $(TOPDIR)/include/linux/autoconf.h.PHONY: $(TOPDIR)/include/linux/modversions.h$(TOPDIR)/include/linux/modversions.h: $(addprefix $(MODINCL)/,$(SYMTAB_OBJS:.o=.ver))@echo updating $(TOPDIR)/include/linux/modversions.h@(echo "#ifdef MODVERSIONS";\echo "#undef CONFIG_MODVERSIONS";\echo "#define CONFIG_MODVERSIONS";\echo "#ifndef _set_ver";\echo "#define _set_ver(sym,vers) sym ## _R ## vers";\echo "#endif";\cd $(TOPDIR)/include/linux/modules; for f in *.ver;\do echo "#include <linux/modules/$${f}>"; done; \echo "#undef CONFIG_MODVERSIONS";\echo "#endif") \> $(TOPDIR)/include/linux/modversions.h$(MX_OBJS): $(TOPDIR)/include/linux/modversions.h$(CC) $(CFLAGS) -DEXPORT_SYMTAB -c $(@:.o=.c)$(LX_OBJS) $(OX_OBJS): $(TOPDIR)/include/linux/modversions.h$(CC) $(CFLAGS) -DMODVERSIONS -DEXPORT_SYMTAB -c $(@:.o=.c)dep fastdep: $(TOPDIR)/include/linux/modversions.hendif$(M_OBJS): $(TOPDIR)/include/linux/modversions.hifdef MAKING_MODULES$(O_OBJS) $(L_OBJS): $(TOPDIR)/include/linux/modversions.hendif# This is needed to ensure proper dependency for multipart modules such as# fs/ext.o. (Otherwise, not all subobjects will be recompiled when# version information changes.)endif## include dependency files they exist#ifeq (.depend,$(wildcard .depend))include .dependendififeq ($(TOPDIR)/.hdepend,$(wildcard $(TOPDIR)/.hdepend))include $(TOPDIR)/.hdependendif
