35 # /usr/ccs/bin/make lacks basically every other flow control mechanism. |
35 # /usr/ccs/bin/make lacks basically every other flow control mechanism. |
36 TEST_FOR_NON_GNUMAKE:sh=echo You are not using GNU make/gmake, this is a requirement. Check your path. 1>&2 && exit 1 |
36 TEST_FOR_NON_GNUMAKE:sh=echo You are not using GNU make/gmake, this is a requirement. Check your path. 1>&2 && exit 1 |
37 |
37 |
38 # Assume we have GNU make, but check version. |
38 # Assume we have GNU make, but check version. |
39 ifeq (,$(findstring 3.81,$(MAKE_VERSION))) |
39 ifeq (,$(findstring 3.81,$(MAKE_VERSION))) |
40 ifeq (,$(findstring 3.82,$(MAKE_VERSION))) |
40 ifeq (,$(findstring 3.82,$(MAKE_VERSION))) |
41 $(error This version of GNU Make is too low ($(MAKE_VERSION)). Check your path, or upgrade to 3.81 or newer.) |
41 $(error This version of GNU Make is too low ($(MAKE_VERSION)). Check your path, or upgrade to 3.81 or newer.) |
42 endif |
42 endif |
43 endif |
43 endif |
44 |
44 |
45 # Locate this Makefile |
45 # Locate this Makefile |
46 ifeq ($(filter /%,$(lastword $(MAKEFILE_LIST))),) |
46 ifeq ($(filter /%,$(lastword $(MAKEFILE_LIST))),) |
47 makefile_path:=$(CURDIR)/$(lastword $(MAKEFILE_LIST)) |
47 makefile_path:=$(CURDIR)/$(lastword $(MAKEFILE_LIST)) |
48 else |
48 else |
49 makefile_path:=$(lastword $(MAKEFILE_LIST)) |
49 makefile_path:=$(lastword $(MAKEFILE_LIST)) |
50 endif |
50 endif |
51 root_dir:=$(dir $(makefile_path)) |
51 root_dir:=$(dir $(makefile_path)) |
52 |
52 |
53 # ... and then we can include our helper functions |
53 # ... and then we can include our helper functions |
54 include $(root_dir)/common/makefiles/MakeHelpers.gmk |
54 include $(root_dir)/common/makefiles/MakeHelpers.gmk |
56 $(eval $(call ParseLogLevel)) |
56 $(eval $(call ParseLogLevel)) |
57 $(eval $(call ParseConfAndSpec)) |
57 $(eval $(call ParseConfAndSpec)) |
58 |
58 |
59 # Now determine if we have zero, one or several configurations to build. |
59 # Now determine if we have zero, one or several configurations to build. |
60 ifeq ($(SPEC),) |
60 ifeq ($(SPEC),) |
61 # Since we got past ParseConfAndSpec, we must be building a global target. Do nothing. |
61 # Since we got past ParseConfAndSpec, we must be building a global target. Do nothing. |
62 else |
62 else |
63 ifeq ($(words $(SPEC)),1) |
63 ifeq ($(words $(SPEC)),1) |
64 # We are building a single configuration. This is the normal case. Execute the Main.gmk file. |
64 # We are building a single configuration. This is the normal case. Execute the Main.gmk file. |
65 include $(root_dir)/common/makefiles/Main.gmk |
65 include $(root_dir)/common/makefiles/Main.gmk |
66 else |
66 else |
67 # We are building multiple configurations. |
67 # We are building multiple configurations. |
68 # First, find out the valid targets |
68 # First, find out the valid targets |
69 # Run the makefile with an arbitrary SPEC using -p -q (quiet dry-run and dump rules) to find |
69 # Run the makefile with an arbitrary SPEC using -p -q (quiet dry-run and dump rules) to find |
70 # available PHONY targets. Use this list as valid targets to pass on to the repeated calls. |
70 # available PHONY targets. Use this list as valid targets to pass on to the repeated calls. |
71 all_phony_targets=$(filter-out $(global_targets) bundles-only, $(strip $(shell \ |
71 all_phony_targets=$(filter-out $(global_targets) bundles-only, $(strip $(shell \ |
72 $(MAKE) -p -q -f common/makefiles/Main.gmk FRC SPEC=$(firstword $(SPEC)) | \ |
72 $(MAKE) -p -q -f common/makefiles/Main.gmk FRC SPEC=$(firstword $(SPEC)) | \ |
73 grep ^.PHONY: | head -n 1 | cut -d " " -f 2-))) |
73 grep ^.PHONY: | head -n 1 | cut -d " " -f 2-))) |
74 |
74 |
75 $(all_phony_targets): |
75 $(all_phony_targets): |
76 @$(foreach spec,$(SPEC),($(MAKE) -f NewMakefile.gmk SPEC=$(spec) \ |
76 @$(foreach spec,$(SPEC),($(MAKE) -f NewMakefile.gmk SPEC=$(spec) \ |
77 $(VERBOSE) VERBOSE=$(VERBOSE) LOG_LEVEL=$(LOG_LEVEL) $@) &&) true |
77 $(VERBOSE) VERBOSE=$(VERBOSE) LOG_LEVEL=$(LOG_LEVEL) $@) &&) true |
78 |
78 |
79 .PHONY: $(all_phony_targets) |
79 .PHONY: $(all_phony_targets) |
80 |
80 |
81 endif |
81 endif |
82 endif |
82 endif |
83 |
83 |
84 # Include this after a potential spec file has been included so that the bundles target |
84 # Include this after a potential spec file has been included so that the bundles target |
85 # has access to the spec variables. |
85 # has access to the spec variables. |
86 include $(root_dir)/common/makefiles/Jprt.gmk |
86 include $(root_dir)/common/makefiles/Jprt.gmk |