SCP: Move .git-commit-id.h to where used

Move .git-commit-id.h include to where it's actually referenced in
scp.c to reduce the recompile overhead for build systems that track
build dependencies.

Ensure that headers that reference SIM_MAJOR include sim_rev.h as a
defensive coding practice.

Net effect: Reduces recompiled source to a minimum when .git-commit-id.h
is updated and removes the sim_defs.h > sim_rev.h > .git-commit-id.h
dependency subgraph. Everything includes sim_defs.h, so a change to
.git-commit-id.h causes a large recompile, vice what should just be a
scp.c recompile and simulator suite relink.

Does not impact makefile builds, since makefile builds will recompile
everything; dependency tracking is superfluous.
This commit is contained in:
B. Scott Michel 2022-12-12 10:09:48 -08:00 committed by Paul Koning
parent 06d41835fe
commit c57f925256
5 changed files with 11 additions and 10 deletions

View file

@ -41,6 +41,7 @@
#include "sim_rev.h" /* For SIM_MAJOR */
#include "sim_tape.h"

View file

@ -38,6 +38,7 @@
#ifndef I1620_DEFS_H_
#define I1620_DEFS_H_ 0
#include "sim_rev.h"
#include "sim_defs.h" /* simulator defns */
#if defined(USE_INT64) || defined(USE_ADDR64)

4
scp.c
View file

@ -249,6 +249,10 @@
#include <editline/readline.h>
#endif
#if defined(SIM_NEED_GIT_COMMIT_ID)
#include ".git-commit-id.h"
#endif
#ifndef MAX
#define MAX(a,b) (((a) >= (b)) ? (a) : (b))
#endif

View file

@ -121,6 +121,7 @@
#define SIM_DEFS_H_ 0
#include "sim_rev.h"
#include <stddef.h>
#include <stdlib.h>
#include <stdio.h>

View file

@ -44,17 +44,11 @@
#define SIM_VERSION_MODE "Current"
#endif
#if defined(SIM_NEED_GIT_COMMIT_ID)
#include ".git-commit-id.h"
#endif
/*
Simh's git commit id would be undefined when working with an
extracted archive (zip file or tar ball). To address this
problem and record the commit id that the archive was created
from, the archive creation process populates the below
information as a consequence of the "sim_rev.h export-subst"
line in the .gitattributes file.
SIM__GIT_COMMMIT_ID is undefined when working with an
archive (zip file or tar ball). Use Git keyword subsitution
to record the archive's commit id via the .gitattributes
"export-subst".
*/
#define SIM_ARCHIVE_GIT_COMMIT_ID $Format:%H$
#define SIM_ARCHIVE_GIT_COMMIT_TIME $Format:%aI$