1
0
mirror of https://github.com/simh/simh.git synced 2026-05-15 17:59:58 +00:00

makefile: Simply identify each separate build step clearly

- More details are displayed when multiple targets are being built with
  or without parallel build activities.
- Display relative path displays when building.  Avoid noisy full path info.
- Pass jobs value in CI builds since some versions of GNU Make don't
  expose the -j value in the MAKEFLAGS internal variable.
This commit is contained in:
Mark Pizzolato
2026-04-07 13:56:22 -10:00
parent 5654a8fba0
commit 4af6470df1
2 changed files with 21 additions and 17 deletions

View File

@@ -63,7 +63,7 @@ build_script:
}
}
if ($ncpus -ne '') {
$parallel = '-j' + $ncpus
$parallel = '-j' + $ncpus + ' NJOBS=' + $ncpus
Write-Host "Building with $ncpus processors"
}
$commit_id_file = '.git-commit-id'

View File

@@ -172,7 +172,9 @@ else
export MKDIR = mkdir -p
export OSTYPE = $(shell uname)
endif
NJOBS:=$(patsubst -j%,%,$(filter -j%,$(MAKEFLAGS)))
ifeq (,$(NJOBS))
NJOBS:=$(patsubst -j%,%,$(filter -j%,$(MAKEFLAGS)))
endif
ifneq (,$(NJOBS))
JOBS:=-j$(NJOBS)
endif
@@ -275,6 +277,8 @@ ifneq (,$(and $(word 1,${MAKECMDGOALS}),$(word 2,${MAKECMDGOALS})))
BUILD_MULTIPLE_VERB = are
MAKECMDGOALS_DESCRIPTION = the $(MAKECMDGOALS) simulators
endif
SHOWTARGET=$(BUILD_MULTIPLE)
export SHOWTARGET
# someone may want to explicitly build simulators without network support
ifneq ($(NONETWORK),)
NETWORK_USEFUL =
@@ -3216,7 +3220,7 @@ else # end of primary make recipies
pathfix = $(1)
endif
find_test = $(if $(findstring 0,$(TESTS)),, RegisterSanityCheck $(if $(abspath $(wildcard $(PRIMARY_SRC)/tests/$(1)_test.ini)),$(abspath $(wildcard $(PRIMARY_SRC)/tests/$(1)_test.ini)),$(abspath $(wildcard $(PRIMARY_INC)/tests/$(1)_test.ini))) </dev/null)
find_test = $(if $(findstring 0,$(TESTS)),, RegisterSanityCheck $(if $(subst //,/, $(wildcard $(PRIMARY_SRC)/tests/$(1)_test.ini)),$(subst //,/, $(wildcard $(PRIMARY_SRC)/tests/$(1)_test.ini)),$(subst //,/, $(wildcard $(PRIMARY_INC)/tests/$(1)_test.ini))) </dev/null)
TARGETNAME = $(basename $(notdir $(TARGET)))
BIN = $(dir $(TARGET))
@@ -3245,49 +3249,49 @@ endef
$(BLDDIR)/%.o : $(word 1,$(DIRS))/%.c
-@$(MKDIR) $(call pathfix,$(dir $@))
ifeq (1,$(QUIET))
@echo $(@D) Compiling $<
@echo $(if $(SHOWTARGET),$(subst BIN/$(OSTYPE)-build/,,$(@D)),) Compiling $<
endif
$(CC) -c $< -o $@ ${OPTS}
$(BLDDIR)/%.o : $(word 1,$(DIRS))/*/%.c
-@$(MKDIR) $(call pathfix,$(dir $@))
ifeq (1,$(QUIET))
@echo $(@D) Compiling $<
@echo $(if $(SHOWTARGET),$(subst BIN/$(OSTYPE)-build/,,$(@D)),) Compiling $<
endif
$(CC) -c $< -o $@ ${OPTS}
$(BLDDIR)/%.o : $(word 1,$(DIRS))/*/*/%.c
-@$(MKDIR) $(call pathfix,$(dir $@))
ifeq (1,$(QUIET))
@echo $(@D) Compiling $<
@echo $(if $(SHOWTARGET),$(subst BIN/$(OSTYPE)-build/,,$(@D)),) Compiling $<
endif
$(CC) -c $< -o $@ ${OPTS}
$(BLDDIR)/%.o : display/%.c
-@$(MKDIR) $(call pathfix,$(dir $@))
ifeq (1,$(QUIET))
@echo $(@D) Compiling $<
@echo $(if $(SHOWTARGET),$(subst BIN/$(OSTYPE)-build/,,$(@D)),) Compiling $<
endif
$(CC) -c $< -o $@ ${OPTS}
$(BLDDIR)/%.o : slirp/%.c
-@$(MKDIR) $(call pathfix,$(dir $@))
ifeq (1,$(QUIET))
@echo $(@D) Compiling $<
@echo $(if $(SHOWTARGET),$(subst BIN/$(OSTYPE)-build/,,$(@D)),) Compiling $<
endif
$(CC) -c $< -o $@ ${OPTS}
$(BLDDIR)/%.o : slirp_glue/%.c
-@$(MKDIR) $(call pathfix,$(dir $@))
ifeq (1,$(QUIET))
@echo $(@D) Compiling $<
@echo $(if $(SHOWTARGET),$(subst BIN/$(OSTYPE)-build/,,$(@D)),) Compiling $<
endif
$(CC) -c $< -o $@ ${OPTS}
$(BLDDIR)/%.o : %.c
-@$(MKDIR) $(call pathfix,$(dir $@))
ifeq (1,$(QUIET))
@echo $(@D) Compiling $<
@echo $(if $(SHOWTARGET),$(subst BIN/$(OSTYPE)-build/,,$(@D)),) Compiling $<
endif
$(CC) -c $< -o $@ ${OPTS}
@@ -3295,42 +3299,42 @@ ifneq (,$(word 2,$(DIRS)))
$(BLDDIR)/%.o : $(word 2,$(DIRS))/%.c
-@$(MKDIR) $(call pathfix,$(dir $@))
ifeq (1,$(QUIET))
@echo $(@D) Compiling $<
@echo $(if $(SHOWTARGET),$(subst BIN/$(OSTYPE)-build/,,$(@D)),) Compiling $<
endif
$(CC) -c $< -o $@ ${OPTS}
$(BLDDIR)/%.o : $(word 2,$(DIRS))/*/%.c
@$(MKDIR) $(call pathfix,$(dir $@))
ifeq (1,$(QUIET))
@echo $(@D) Compiling $<
@echo $(if $(SHOWTARGET),$(subst BIN/$(OSTYPE)-build/,,$(@D)),) Compiling $<
endif
$(CC) -c $< -o $@ ${OPTS}
$(BLDDIR)/%.o : $(word 2,$(DIRS))/*/*/%.c
@$(MKDIR) $(call pathfix,$(dir $@))
ifeq (1,$(QUIET))
@echo $(@D) Compiling $<
@echo $(if $(SHOWTARGET),$(subst BIN/$(OSTYPE)-build/,,$(@D)),) Compiling $<
endif
$(CC) -c $< -o $@ ${OPTS}
ifneq (,$(word 3,$(DIRS)))
$(BLDDIR)/%.o : $(word 3,$(DIRS))/%.c
@$(MKDIR) $(call pathfix,$(dir $@))
ifeq (1,$(QUIET))
@echo $(@D) Compiling $<
@echo $(if $(SHOWTARGET),$(subst BIN/$(OSTYPE)-build/,,$(@D)),) Compiling $<
endif
$(CC) -c $< -o $@ ${OPTS}
$(BLDDIR)/%.o : $(word 3,$(DIRS))/*/%.c
@$(MKDIR) $(call pathfix,$(dir $@))
ifeq (1,$(QUIET))
@echo $(@D) Compiling $<
@echo $(if $(SHOWTARGET),$(subst BIN/$(OSTYPE)-build/,,$(@D)),) Compiling $<
endif
$(CC) -c $< -o $@ ${OPTS}
$(BLDDIR)/%.o : $(word 3,$(DIRS))/*/*/%.c
@$(MKDIR) $(call pathfix,$(dir $@))
ifeq (1,$(QUIET))
@echo $(@D) Compiling $<
@echo $(if $(SHOWTARGET),$(subst BIN/$(OSTYPE)-build/,,$(@D)),) Compiling $<
endif
$(CC) -c $< -o $@ ${OPTS}
endif
@@ -3346,7 +3350,7 @@ endif
$(TARGET): $(OBJS)
$(MKDIRBIN)
ifeq (1,$(QUIET))
@echo $(TARGET) Linking
@echo $(subst BIN/,,$(TARGET)) Linking
endif
${CC} $(OBJS) ${OPTS} ${LNK_OPTS} -o $@ ${LDFLAGS}
else