Skip to content

Commit

Permalink
Fixes build-submodules.mk to easily omit submodules
Browse files Browse the repository at this point in the history
also reducing the magic of including generated .mk files
  • Loading branch information
netj committed Jan 8, 2017
1 parent 80fcf57 commit e28e914
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -184,11 +184,11 @@ checkstyle:

# submodules to build and the files to copy out from each of them
include util/build/build-submodules.mk
$(BUILD_SUBMODULE)/inference/dimmwitted.mk : COPY = dw
$(BUILD_SUBMODULE)/compiler/ddlog.mk : COPY = target/scala-2.11/ddlog-assembly-0.1-SNAPSHOT.jar
$(BUILD_SUBMODULE)/runner/mkmimo.mk : COPY = mkmimo
$(call BUILD_SUBMODULE_AND_COPY, inference/dimmwitted, dw )
$(call BUILD_SUBMODULE_AND_COPY, compiler/ddlog , target/scala-2.11/ddlog-assembly-0.1-SNAPSHOT.jar )
$(call BUILD_SUBMODULE_AND_COPY, runner/mkmimo , mkmimo )
ifndef NO_MINDBENDER
$(BUILD_SUBMODULE)/util/mindbender.mk : COPY = @prefix@/
$(call BUILD_SUBMODULE_AND_COPY, util/mindbender , @prefix@/ )
endif

# XXX legacy targets kept to reduce surprise
Expand Down
9 changes: 5 additions & 4 deletions util/build/build-submodules.mk
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ $(BUILD_SUBMODULE)/%.mk: $(MAKEFILE_LIST)
@echo >>$@ 'rebuild-submodules: rebuild-submodule-$(*F)'
@chmod a-w $@

# generate and include all recipes for submodules that are defined somewhere
# FIXME maybe switch to $(eval ...) to expand all variables not just BUILD_SUBMODULE
include $(subst $$(BUILD_SUBMODULE),$(BUILD_SUBMODULE), \
$(shell sed '/^$$(BUILD_SUBMODULE)\/.*\.mk *: *COPY/ !d; s/:.*//' $(MAKEFILE_LIST)))
# define a shorthand for both generating and including the submodule Makefile and specifying the files to copy
define BUILD_SUBMODULE_AND_COPY
include $(BUILD_SUBMODULE)/$(strip $(1)).mk
$(BUILD_SUBMODULE)/$(strip $(1)).mk: COPY=$(2)
endef

0 comments on commit e28e914

Please sign in to comment.