makefile: make just nmake make

Use a comment trick to make `nmake` see a different default target
than `make`, which will save a small amount of hassle from forgetting
to type `nmake win`.
This commit is contained in:
Matthew Flatt 2021-01-30 14:15:33 -07:00
parent ee43d982e4
commit 53b3cc5eb4
3 changed files with 11 additions and 2 deletions

View File

@ -3,7 +3,7 @@
# on the `make` dialect that it uses.
#
# The targets here do not use dependencies (mostly), so it's a strange
# use of `make'. Really, this makefile is an alternative to a pile of
# use of `make`. Really, this makefile is an alternative to a pile of
# scripts, where each target plays the role of a script. It's written
# as a makefile, because then the intersection of `make` and `nmake`
# acts as a kind of always-available scripting language.
@ -31,6 +31,10 @@
# `make`. For example, `PKGS` can be supplied with `make PKGS="..."`.
# Not all variables in the makefile are intended as arguments,
# though.
#
# For Windows with `nmake`, add `win-` to the start of the above
# targets. Using `nmake` by itself is the same as `nmake win`, which
# is the same as `nmake win-in-place`.
# Packages (separated by spaces) to link in development mode or
# to include in a distribution:
@ -39,6 +43,8 @@ PKGS = main-distribution main-distribution-test
main:
$(MAKE) in-place
# The makefile is compiled so that a target named `win` is the
# default target for `nmake`:
win:
$(MAKE) win-in-place
@ -762,7 +768,7 @@ random:
# ------------------------------------------------------------
# On a server platform (for an installer build):
# These targets require GNU `make', so that we don't have to propagate
# These targets require GNU `make`, so that we don't have to propagate
# variables through all of the target layers.
server:

View File

@ -135,6 +135,8 @@ DRIVE_ARGS_q = $(RELEASE_MODE) $(VERSIONLESS_MODE) $(SOURCE_MODE) $(CLEAN_MODE)
DRIVE_DESCRIBE =
DRIVE_CMD_q = -l- distro-build/drive-clients $(DRIVE_DESCRIBE) $(RELEASE_MODE) $(VERSIONLESS_MODE) $(SOURCE_MODE) $(CLEAN_MODE) $(SERVER_COMPILE_MACHINE) "$(CONFIG)" "$(CONFIG_MODE)" $(SERVER) $(SERVER_PORT) "$(SERVER_HOSTS)" "$(PKGS)" "$(DOC_SEARCH)" "$(DIST_NAME)" $(DIST_BASE) $(DIST_DIR)
DOC_CATALOGS = build/built/catalog build/native/catalog
# `make` will continue this comment to the next line, but `nmake` won't \
the-default-target-for-nmake: win
main:
$(MAKE) in-place AS_IS="$(AS_IS)" CONFIGURE_ARGS="$(CONFIGURE_ARGS)" CONFIG_IN_PLACE_ARGS="$(CONFIG_IN_PLACE_ARGS)" CPUS="$(CPUS)" CS_CONFIGURE_ARGS="$(CS_CONFIGURE_ARGS)" CS_CROSS_SUFFIX="$(CS_CROSS_SUFFIX)" CS_HOST_WORKAREA_PREFIX="$(CS_HOST_WORKAREA_PREFIX)" DEFAULT_SRC_CATALOG="$(DEFAULT_SRC_CATALOG)" EXTRA_REPOS_BASE="$(EXTRA_REPOS_BASE)" INITIAL_SETUP_MODE="$(INITIAL_SETUP_MODE)" IN_PLACE_SETUP_OPTIONS="$(IN_PLACE_SETUP_OPTIONS)" JOB_OPTIONS="$(JOB_OPTIONS)" MORE_CONFIGURE_ARGS="$(MORE_CONFIGURE_ARGS)" PB_REPO="$(PB_REPO)" PKGS="$(PKGS)" PKG_UPDATE_OPTIONS="$(PKG_UPDATE_OPTIONS)" PLT_SETUP_OPTIONS="$(PLT_SETUP_OPTIONS)" RACKETBC_SUFFIX="$(RACKETBC_SUFFIX)" RACKETCS_SUFFIX="$(RACKETCS_SUFFIX)" RACKET_FOR_BOOTFILES="$(RACKET_FOR_BOOTFILES)" RACKET_FOR_BUILD="$(RACKET_FOR_BUILD)" SELF_ROOT_CONFIG_FLAG="$(SELF_ROOT_CONFIG_FLAG)" SETUP_MACHINE_FLAGS="$(SETUP_MACHINE_FLAGS)" SRC_CATALOG="$(SRC_CATALOG)" VM="$(VM)"
win:

View File

@ -266,4 +266,5 @@
(loop #f)))
(call-with-input-file* src variables)
(printf "# `make` will continue this comment to the next line, but `nmake` won't \\\nthe-default-target-for-nmake: win\n")
(call-with-input-file* src convert)