diff options
-rw-r--r-- | external/common/rules.mk | 20 | ||||
-rw-r--r-- | external/pflash/rules.mk | 7 |
2 files changed, 17 insertions, 10 deletions
diff --git a/external/common/rules.mk b/external/common/rules.mk index 4d94fe8..356c207 100644 --- a/external/common/rules.mk +++ b/external/common/rules.mk @@ -1,27 +1,29 @@ -ARCH = $(shell $(GET_ARCH) "$(CROSS_COMPILE)") +ARCH := $(shell $(GET_ARCH) "$(CROSS_COMPILE)") ifeq ($(ARCH),ARCH_ARM) -arch = arm -ARCH_OBJS = common-arch_flash_common.o common-arch_flash_arm.o common-ast-sf-ctrl.o +arch := arm +ARCH_FILES := arch_flash_common.c arch_flash_arm.c ast-sf-ctrl.c else ifeq ($(ARCH),ARCH_POWERPC) -arch = powerpc -ARCH_OBJS = common-arch_flash_common.o common-arch_flash_powerpc.o +arch := powerpc +ARCH_FILES := arch_flash_common.c arch_flash_powerpc.c else ifeq ($(ARCH),ARCH_X86) -arch = x86 -ARCH_OBJS = common-arch_flash_common.o common-arch_flash_x86.o +arch := x86 +ARCH_FILES := arch_flash_common.c arch_flash_x86.c else $(error Unsupported architecture $(ARCH)) endif endif endif +ARCH_SRC := $(addprefix common/,$(ARCH_FILES)) +ARCH_OBJS := $(addprefix common-,$(ARCH_FILES:.c=.o)) # Arch links are like this so we can have dependencies work (so that we don't # run the rule when the links exist), pretty build output (knowing the target # name) and a list of the files so we can clean them up. -ARCH_LINKS = common/ast-sf-ctrl.c common/ast.h common/io.h +ARCH_LINKS := common/ast-sf-ctrl.c common/ast.h common/io.h arch_links: $(ARCH_LINKS) common/ast.h : ../../include/ast.h | common @@ -37,6 +39,8 @@ common/ast-sf-ctrl.c : ../../hw/ast-bmc/ast-sf-ctrl.c | common arch_clean: rm -rf $(ARCH_OBJS) $(ARCH_LINKS) +$(ARCH_SRC): | common + $(ARCH_OBJS): common-%.o: common/%.c $(Q_CC)$(CROSS_COMPILE)gcc $(CFLAGS) -c $< -o $@ diff --git a/external/pflash/rules.mk b/external/pflash/rules.mk index f49e438..219e3d3 100644 --- a/external/pflash/rules.mk +++ b/external/pflash/rules.mk @@ -2,8 +2,9 @@ override CFLAGS += -O2 -Wall -I. OBJS = pflash.o progress.o version.o -LIBFLASH_OBJS += libflash-libflash.o libflash-libffs.o libflash-ecc.o \ - libflash-blocklevel.o libflash-file.o +LIBFLASH_FILES := libflash.c libffs.c ecc.c blocklevel.c file.c +LIBFLASH_OBJS := $(addprefix libflash-, $(LIBFLASH_FILES:.c=.o)) +LIBFLASH_SRC := $(addprefix libflash/,$(LIBFLASH_FILES)) OBJS += $(LIBFLASH_OBJS) OBJS += common-arch_flash.o EXE = pflash @@ -22,6 +23,8 @@ version.c: .version %.o : %.c $(Q_CC)$(CC) $(CFLAGS) -c $< -o $@ +$(LIBFLASH_SRC): | links + $(LIBFLASH_OBJS): libflash-%.o : libflash/%.c $(Q_CC)$(CC) $(CFLAGS) -c $< -o $@ |