sim: introduce {COMPILE,LINK}_FOR_BUILD

These use the same pattern as seen in the opcodes/ dir and in automake
in general (ish).  This helps simplify the boilerplate for building and
linking build-time code, and fixes some inconsistency in flag usage.

For rules that were compiling+linking in a single step, split them into
separate steps so we can apply the correct set of options.  This matches
automake behavior too.
This commit is contained in:
Mike Frysinger
2021-03-08 01:41:35 -05:00
parent 367c5eb750
commit c6c7769d9d
16 changed files with 111 additions and 49 deletions

View File

@@ -1,3 +1,9 @@
2021-03-13 Mike Frysinger <vapier@gentoo.org>
* Make-common.in (COMPILE_FOR_BUILD, LINK_FOR_BUILD): Define.
(gentmap.o): New rule.
(gentmap): Call LINK_FOR_BUILD.
2021-03-07 Mike Frysinger <vapier@gentoo.org>
* Make-common.in (check): Delete body.

View File

@@ -248,6 +248,9 @@ EXTRA_LIBS = $(BFD_LIB) $(OPCODES_LIB) $(LIBINTL) $(LIBIBERTY_LIB) \
LIB_OBJS = callback.o syscall.o targ-map.o version.o $(SIM_OBJS)
COMPILE_FOR_BUILD = $(CC_FOR_BUILD) $(BUILD_CFLAGS)
LINK_FOR_BUILD = $(CC_FOR_BUILD) $(BUILD_CFLAGS) $(BUILD_LDFLAGS) -o $@
RUNTESTFLAGS =
callback_h = $(srcroot)/include/gdb/callback.h
@@ -269,8 +272,11 @@ run$(EXEEXT): $(SIM_RUN_OBJS) libsim.a $(LIBDEPS)
# devo/libremote because this directory would contain more than just
# a library).
gentmap: Makefile $(srccom)/gentmap.c $(srccom)/nltvals.def
$(CC_FOR_BUILD) $(srccom)/gentmap.c -o gentmap $(BUILD_CFLAGS) $(NL_TARGET)
gentmap.o: Makefile $(srccom)/gentmap.c $(srccom)/nltvals.def
$(COMPILE_FOR_BUILD) -o $@ -c $(srccom)/gentmap.c $(NL_TARGET)
gentmap: gentmap.o
$(LINK_FOR_BUILD) $<
targ-vals.h targ-map.c: stamp-tvals
stamp-tvals: gentmap