#external.rules: Support for external (self-configurable) components # # This mechanism can be easily used to implement a `visibility' # functionality to each make component. Use the settings # TARGET_FLAGS=-DWITH_$(TARGET) TARGET_LIB=-l$(TARGET) # # in the local Makefiles, such that any C/C++ source can test the # availability of another library/package with an #ifdef WITH_... # TARGETCFG = $(LIB_PATH)/$(TARGET).cfg remove-config: -$(RM) $(LIB_PATH)/$(TARGET).cfg # # This target should rarely be used, since it modifies global # variables which are used for any other make target. # This target can be used to FORCE visibility to all other # makefile targets. # global-config: $(LIB_PATH) $(VPATH)GNUmakefile echo 'INCLUDES+=$(TARGET_INCLUDES)' >> $(TARGETCFG) echo 'SYSCFLAGS+=$(TARGET_CFLAGS)' >> $(TARGETCFG) echo 'LDFLAGS+=$(TARGET_LDFLAGS)' >> $(TARGETCFG) # # This target sets some target-specific names, which can be used # by other target makefiles to test, if this package is available. # This target can be used to make a package visible to another # package, which knows of the possible existence of this one. # visible: $(LIB_PATH) $(VPATH)GNUmakefile echo '$(TARGET)_FLAGS=$(TARGET_FLAGS)' >> $(TARGETCFG) echo '$(TARGET)_LIB=$(TARGET_LIB)' >> $(TARGETCFG) help:: external.help help.external: external.help external.help: @ echo 'Make targets from external.rules:' @ echo ' global-config .... Add target specific flags to the global configuration' @ echo ' visible .......... Add target flags (-DWITH_$(TARGET) ...) to the configuration' @ echo ' remove-config .... Remove target configuration file' @ echo ' Note: Config is stored in $$LIB_PATH/$$TARGET.cfg' @ echo ' which is: $(LIB_PATH)/$(TARGET).cfg' @ echo makevars:: makevars.external external.makevars: makevars.external makevars.external: @ echo 'Make variables used in external.rules:' @ echo ' TARGET ........... the name of the configuration, to be used for makefile inclusion' @ echo ' LIB_PATH ......... where to create the configuration file' @ echo ' VPATH ............ from where this make is invoked' @ echo ' TARGETCFG ........ full path name of the make include file for this target' @ echo ' For the "global-config" target:' @ echo ' TARGET_INCLUDES .. include paths to be added to the global INCLUDES variable' @ echo ' TARGET_CFLAGS .... C flags to be added to the global CFLAGS variable' @ echo ' TARGET_LDFLAGS ... Linker flags to be added to the global LDFLAGS variable' @ echo ' For the "visible" target:' @ echo ' TARGET_FLAGS .... The content of the global $(TARGET)_FLAGS variable' @ echo ' TARGET_LIB ...... The content of the global $(TARGET)_LIB variable' @ echo '' debug:: debug.external external.debug: debug.external debug.external: @ echo 'Make variables used in external.rules:' @ echo ' TARGET ........... $(TARGET)' @ echo ' LIB_PATH ......... $(LIB_PATH)' @ echo ' VPATH ............ $(VPATH)' @ echo ' TARGETCFG ........ $(TARGETCFG)' @ echo ' TARGET_CFLAGS .... $(TARGET_CFLAGS)' @ echo ' TARGET_LDFLAGS ... $(TARGET_LDFLAGS)' @ echo ' TARGET_INCLUDES... $(TARGET_INCLUDES)' @ echo ' TARGET_FLAGS ..... $(TARGET_FLAGS)' @ echo ' TARGET_LIB ....... $(TARGET_LIB)' @ echo ''