Skip to content

Commit

Permalink
SCP: Move .git-commit-id.h to where used
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
bscottm authored and pkoning2 committed Oct 24, 2023
1 parent 06d4183 commit c57f925
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 10 deletions.
1 change: 1 addition & 0 deletions HP3000/hp_tapelib.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@



#include "sim_rev.h" /* For SIM_MAJOR */
#include "sim_tape.h"


Expand Down
1 change: 1 addition & 0 deletions I1620/i1620_defs.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 4 additions & 0 deletions scp.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions sim_defs.h
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@
#define SIM_DEFS_H_ 0

#include "sim_rev.h"

#include <stddef.h>
#include <stdlib.h>
#include <stdio.h>
Expand Down
14 changes: 4 additions & 10 deletions sim_rev.h
Original file line number Diff line number Diff line change
Expand Up @@ -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$
Expand Down

0 comments on commit c57f925

Please sign in to comment.