diff options
Diffstat (limited to 'drivers/mt5931/drv_wlan/rules.make')
-rwxr-xr-x | drivers/mt5931/drv_wlan/rules.make | 104 |
1 files changed, 104 insertions, 0 deletions
diff --git a/drivers/mt5931/drv_wlan/rules.make b/drivers/mt5931/drv_wlan/rules.make new file mode 100755 index 00000000..44b98711 --- /dev/null +++ b/drivers/mt5931/drv_wlan/rules.make @@ -0,0 +1,104 @@ +# -------------------------------------------------------------------- +# Copyright (c) 2007 MediaTek Inc. +# +# All rights reserved. Copying, compilation, modification, distribution +# or any other use whatsoever of this material is strictly prohibited +# except in accordance with a Software License Agreement with +# MediaTek Inc. +# -------------------------------------------------------------------- + +# -------------------------------------------------------------------- +# This file contains rules which are shared between multiple Makefiles. +# -------------------------------------------------------------------- + +# +# False targets. +# +.PHONY: dummy + +# +# Special variables which should not be exported +# +unexport O_TARGET +unexport obj-y +unexport subdir-y + +comma := , + + +# +# Get things started. +# +first_rule: sub_dirs + @$(MAKE) all_targets + +SUB_DIRS := $(subdir-y) + +# +# Common rules +# +%.o: %.c + @echo " [CC] $@" + @$(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $< + +all_targets: $(O_TARGET) + +# +# Rule to compile a set of .o files into one .o file +# +ifdef O_TARGET +$(O_TARGET): $(obj-y) + @rm -f $@ + ifneq "$(strip $(obj-y))" "" + @$(LD) $(EXTRA_LDFLAGS) -r -o $@ $(filter $(obj-y), $^) + else + @$(AR) rcs $@ + endif + @ ( \ + echo 'ifeq ($(strip $(subst $(comma),:,$(EXTRA_LDFLAGS) $(obj-y))),$$(strip $$(subst $$(comma),:,$$(EXTRA_LDFLAGS) $$(obj-y))))' ; \ + echo 'FILES_FLAGS_UP_TO_DATE += $@' ; \ + echo 'endif' \ + ) > $(dir $@)/.$(notdir $@).flags +endif # O_TARGET + +# +# A rule to make subdirectories +# +subdir-list = $(sort $(patsubst %,_subdir_%,$(SUB_DIRS))) +sub_dirs: dummy $(subdir-list) + +ifdef SUB_DIRS +$(subdir-list) : dummy + @$(MAKE) -C $(patsubst _subdir_%,%,$@) +endif + + +# +# A rule to do nothing +# +dummy: + +# +# Find files whose flags have changed and force recompilation. +# For safety, this works in the converse direction: +# every file is forced, except those whose flags are positively up-to-date. +# +FILES_FLAGS_UP_TO_DATE := + +# For use in expunging commas from flags, which mung our checking. +comma = , + +FILES_FLAGS_EXIST := $(wildcard .*.flags) +ifneq ($(FILES_FLAGS_EXIST),) +include $(FILES_FLAGS_EXIST) +endif + +FILES_FLAGS_CHANGED := $(strip \ + $(filter-out $(FILES_FLAGS_UP_TO_DATE), \ + $(O_TARGET) \ + )) + +ifneq ($(FILES_FLAGS_CHANGED),) +$(FILES_FLAGS_CHANGED): dummy +endif + |