[71/83] sim: common: move test-hw-events to top-level build

Message ID 20230103075605.13606-72-vapier@gentoo.org
State Committed
Headers
Series sim: merge subdir makefiles into top-level |

Commit Message

Mike Frysinger Jan. 3, 2023, 7:55 a.m. UTC
  This is an internal developer target that isn't normally compiled,
but it can still be occasionally useful.  Move it to the top-level
build so we can kill off common/Make-common.in.
---
 sim/Makefile.in           | 6 ++++++
 sim/common/Make-common.in | 5 -----
 sim/common/hw-events.c    | 2 ++
 sim/common/local.mk       | 9 +++++++++
 4 files changed, 17 insertions(+), 5 deletions(-)
  

Patch

diff --git a/sim/common/Make-common.in b/sim/common/Make-common.in
index 15242c612647..a081525c91ce 100644
--- a/sim/common/Make-common.in
+++ b/sim/common/Make-common.in
@@ -154,11 +154,6 @@  override COMPILE.pre = source='$<' object='$@' libtool=no \
 override POSTCOMPILE =
 endif
 
-test-hw-events: $(srccom)/hw-events.c libsim.a
-	$(ECHO_CCLD) $(LIBTOOL) $(AM_V_lt) --tag=CC --mode=link \
-		$(CC) $(ALL_CFLAGS) -DMAIN -o test-hw-events$(EXEEXT) \
-		$(srccom)/hw-events.c libsim.a $(EXTRA_LIBS)
-
 # Support targets.
 
 install:
diff --git a/sim/common/hw-events.c b/sim/common/hw-events.c
index 99e2f1a7fd8d..fc579a85706c 100644
--- a/sim/common/hw-events.c
+++ b/sim/common/hw-events.c
@@ -23,6 +23,8 @@  along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 #include <stdarg.h>
 #include <string.h>
 
+#include "sim/callback.h"
+
 #include "hw-main.h"
 #include "hw-base.h"
 
diff --git a/sim/common/local.mk b/sim/common/local.mk
index 32b5db6a6eea..f79a30113740 100644
--- a/sim/common/local.mk
+++ b/sim/common/local.mk
@@ -52,6 +52,15 @@  noinst_LIBRARIES += %D%/libcommon.a
 CLEANFILES += \
 	%D%/version.c %D%/version.c-stamp
 
+## NB: This is a bit of a hack.  If we can generalize the common/ files, we can
+## turn this from an arch-specific %/test-hw-events into a common/test-hw-events
+## program.
+.PRECIOUS: %/test-hw-events.o
+%/test-hw-events.o: common/hw-events.c
+	$(AM_V_CC)$(COMPILE) -DMAIN -c -o $@ $<
+%/test-hw-events: %/test-hw-events.o %/libsim.a
+	$(AM_V_CCLD)$(LINK) -o $@ $^ $(SIM_COMMON_LIBS) $(LIBS)
+
 ##
 ## For subdirs.
 ##