Wajideu wrote:The same things you'd do with autotools; detecting the presence of programs, headers, and functions. Detecting the host and target platforms, handling user specified options like "--disable-nls", etc.
I kind of wanted a stripped down example that you've created to translate but here's a crack at part of the configure.in script in make++ format for a general project.
Call using
make++ config disable-nls=1
Code: Select all
# Top level Makefile
# Make++ check
ifndef $(_MAKE_PP_)
$(error This project requires make++)
endif
all: foo bar
CONFIG_FILE := config.mk
ifeq ($(MAKECMDGOALS), config)
include configure.mk
endif
-include $(CONFIG_FILE) # Saved configuration settings after running 'make config'
include foo.mk
include bar.mk
Code: Select all
# configure.mk
config:{
# This would be all your AC stuff
# The minimum gcc version numbers
REQUIRED_CC = 4.8
# Check standard headers are installed
REQUIRED_HEADER_STDC = 1
# Check format of time header
REQUIRED_HEADER_TIME = 1
# A static script, maybe in the make++ include directory
include autoconfig.mk
# Manual check for external programs needed not in the autoconfig check list
# This requires more processing to strip the version form the output string
PERL_VERSION = $(shell perl -v)
}
Code: Select all
# autoconfig.mk
# This is basically the equivalent configure script generated by autotools
# written in make++ script format.
# Make++ handes the script so a bash shell isn't required.
#
# Straight scripting code so needs to be included after all the configuration setup.
ifdef($(REQUIRED_CC)){
# Usual bash scripts for checking in make++ script form
}
# Continues with all the usual check scripts
# Writes all saved options to $(CONFIG_FILE)
Very cut down example but it would be possible to skip the step from configure.in to configure to Makefile.
Wajideu wrote:There are several cases in which a person would need to build a project in multiple stages. For example, they may need to build tools to build a part of themselves, the user may be performing a Canadian cross compilation, or another example being something like binutils/gcc where you have to build both first in order to compile the C runtime and rebuild them a second time to link against it.
If make already handles it natively so would make++.