Customized make file inclusion (original) (raw)
David Holmes david.holmes at oracle.com
Mon Jan 16 05:01:07 UTC 2012
- Previous message (by thread): Build openjdk in Ubuntu 11.10
- Next message (by thread): Customized make file inclusion
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Presently the build system contains some files, and directives involving those files, that supports the building of the Java SE Embedded product. What I would like to do is remove direct support for this and replace it with a more general mechanism that allows for custom make files to be included from an arbitrary location - which then allows for the removal of the embedded specific files.
Initially I've modeled this on some other conditional mechanisms by defining the default location for non-OpenJDK builds, checking its existence and then using that as a guard for the individual files.
http://cr.openjdk.java.net/~dholmes/custom-make/webrev/
! ifneq ($(OPENJDK),true) ! CUSTOM_MAKE_DIR_REL=closed ! else ! CUSTOM_MAKE_DIR_REL=NO_SUCH_PATH ! endif ! CUSTOM_MAKE_DIR=$(BUILDDIR)/$(CUSTOM_MAKE_DIR_REL)
Use this variable to guard inclusion of the custom files
- HAS_CUSTOM_MAKE := (shellif[−d(shell if [ -d (shellif[−d(CUSTOM_MAKE_DIR) ]; then echo 1; else echo 0; fi)
...
- ifeq ($(HAS_CUSTOM_MAKE),1)
- include $(CUSTOM_MAKE_DIR)/Defs.gmk
- endif
Initially there are only two hooks for these custom files:
- At the end common/Defs.gmk (as it gets included by all the Makefiles)
- In the top-level JDK Makefile, including a custom Release.gmk
Naturally these map to the existing uses of the *-embedded.gmk files.
It then occurred to me that if someone wanted to add an additional hook somewhere else, that it might be best to check for the existence of the actual file rather than a root directory for all such files. That led me to consider a function custom_include() to hide the existence logic. But I wasn't sure if a function could contain an include directive and upon checking on that I discovered a much simpler approach: the -include directive. This is like the include directive but does not trigger an error if the file does not exist. So we would simply have this in Defs.gmk:
ifneq ($(OPENJDK),true) CUSTOM_MAKE_DIR_REL=closed else CUSTOM_MAKE_DIR_REL=NO_SUCH_PATH endif CUSTOM_MAKE_DIR=$(BUILDDIR)/$(CUSTOM_MAKE_DIR_REL)
and then
-include $(CUSTOM_MAKE_DIR)/<path-to-file.gmk>
wherever we needed it (again initially only the two locations I mentioned).
I'd like to hear people's opinions on this.
Thanks, David
- Previous message (by thread): Build openjdk in Ubuntu 11.10
- Next message (by thread): Customized make file inclusion
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]