sim: common: move test-hw-events to top-level build
authorMike Frysinger <vapier@gentoo.org>
Mon, 2 Jan 2023 00:03:28 +0000 (19:03 -0500)
committerMike Frysinger <vapier@gentoo.org>
Tue, 10 Jan 2023 06:15:29 +0000 (01:15 -0500)
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
sim/common/Make-common.in
sim/common/hw-events.c
sim/common/local.mk

index 099bfd56b9851b083cb4a5fd6602912583ccae9e..c13239058bcaa599b71ef1120bba66bee7fbb983 100644 (file)
@@ -4585,6 +4585,12 @@ common/version.c-stamp: $(srcroot)/gdb/version.in $(srcroot)/bfd/version.h $(src
        $(AM_V_at)$(SHELL) $(srcroot)/move-if-change $@.tmp $(@:-stamp=)
        $(AM_V_at)touch $@
 
+.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)
+
 # FIXME This is one very simple-minded way of generating the file hw-config.h.
 %/hw-config.h: %/stamp-hw ; @true
 %/stamp-hw: Makefile
index 15242c6126476a86a560a18f8b5d1d01ca2d3d4f..a081525c91ce691f1f80fd5d2d66fecf03793bab 100644 (file)
@@ -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:
index 99e2f1a7fd8dccb4a1a070d5e8de5ae3cace0e9f..fc579a85706cd78999b7dc1b6a64c6b9023b2f40 100644 (file)
@@ -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"
 
index 32b5db6a6eea1cae160a7f057bd4260f8ae9af46..f79a30113740437ba00efaba5e8f4273fd61db96 100644 (file)
@@ -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.
 ##