Thomas Heijligen has uploaded this change for review. ( https://review.coreboot.org/c/flashrom/+/61034 )
Change subject: [RFC][WIP] Makefile: use directory for object files ......................................................................
[RFC][WIP] Makefile: use directory for object files
Use $(OBJPATH), defaults to .obj, as storage location for object and dependency files. This keeps the main source directory clean. The Makefile in util/ich_descriptors_tool does this already.
Change-Id: Id0b5eea0b4c941f5af37c0d27dcc95c0bb45461f Signed-off-by: Thomas Heijligen thomas.heijligen@secunet.com --- M Makefile 1 file changed, 9 insertions(+), 5 deletions(-)
git pull ssh://review.coreboot.org:29418/flashrom refs/changes/34/61034/1
diff --git a/Makefile b/Makefile index b8287a9..47efebc 100644 --- a/Makefile +++ b/Makefile @@ -36,6 +36,7 @@ RANLIB ?= ranlib PKG_CONFIG ?= pkg-config BUILD_DETAILS_FILE ?= build_details.txt +OBJPATH = .obj
# The following parameter changes the default programmer that will be used if there is no -p/--programmer # argument given when running flashrom. The predefined setting does not enable any default so that every @@ -906,8 +907,8 @@ @+$(MAKE) -C util/ich_descriptors_tool/ HOST_OS=$(HOST_OS) TARGET_OS=$(TARGET_OS) endif
-$(PROGRAM)$(EXEC_SUFFIX): $(OBJS) - $(CC) -o $(PROGRAM)$(EXEC_SUFFIX) $(OBJS) $(LDFLAGS) $(LIBS) $(PCILIBS) $(FEATURE_LIBS) +$(PROGRAM)$(EXEC_SUFFIX): $(addprefix $(OBJPATH)/,$(OBJS)) + $(CC) -o $(PROGRAM)$(EXEC_SUFFIX) $^ $(LDFLAGS) $(LIBS) $(PCILIBS) $(FEATURE_LIBS)
libflashrom.a: $(LIBFLASHROM_OBJS) $(AR) rcs $@ $^ @@ -918,14 +919,17 @@ # stored files, they can be handled here as well. TAROPTIONS = $(shell LC_ALL=C tar --version|grep -q GNU && echo "--owner=root --group=root")
-%.o: %.c features +_create_OBJPATH: + mkdir -p $(OBJPATH) + +$(OBJPATH)/%.o: %.c features _create_OBJPATH $(CC) -MMD $(CFLAGS) $(CPPFLAGS) $(FLASHROM_CFLAGS) $(FEATURE_CFLAGS) $(SCMDEF) -o $@ -c $<
# Make sure to add all names of generated binaries here. # This includes all frontends and libflashrom. # We don't use EXEC_SUFFIX here because we want to clean everything. clean: - rm -f $(PROGRAM) $(PROGRAM).exe libflashrom.a $(filter-out Makefile.d, $(wildcard *.d *.o)) $(PROGRAM).8 $(PROGRAM).8.html $(BUILD_DETAILS_FILE) + rm -rf $(PROGRAM) $(PROGRAM).exe libflashrom.a $(PROGRAM).8 $(PROGRAM).8.html $(BUILD_DETAILS_FILE) $(OBJPATH) @+$(MAKE) -C util/ich_descriptors_tool/ clean
distclean: clean @@ -1086,4 +1090,4 @@ # Disable implicit suffixes and built-in rules (for performance and profit) .SUFFIXES:
--include $(OBJS:.o=.d) +-include $(OBJPATH)/$(OBJS:.o=.d)