]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blobdiff - sim/common/Make-common.in
sim: introduce {COMPILE,LINK}_FOR_BUILD
[thirdparty/binutils-gdb.git] / sim / common / Make-common.in
index b254bf6ce0c7bc4b8e2bdee4b5315f85207085c9..8b35deb5167955f89a99083e21515f254f985f03 100644 (file)
@@ -1,5 +1,5 @@
 # Makefile fragment for common parts of all simulators.
-# Copyright 1997-2020 Free Software Foundation, Inc.
+# Copyright 1997-2021 Free Software Foundation, Inc.
 # Contributed by Cygnus Support.
 
 # This program is free software; you can redistribute it and/or modify
@@ -70,6 +70,7 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@
 INSTALL_DATA = @INSTALL_DATA@
 
 CC = @CC@
+C_DIALECT = @C_DIALECT@
 CC_FOR_BUILD = @CC_FOR_BUILD@
 CFLAGS = @CFLAGS@
 CPPFLAGS = @CPPFLAGS@
@@ -92,9 +93,6 @@ WERROR_CFLAGS = @WERROR_CFLAGS@
 SIM_WARN_CFLAGS = $(WARN_CFLAGS)
 SIM_WERROR_CFLAGS = $(WERROR_CFLAGS)
 
-HDEFINES = @HDEFINES@
-TDEFINES =
-
 AR = @AR@
 AR_FLAGS = rc
 RANLIB = @RANLIB@
@@ -107,7 +105,7 @@ depcomp = $(SHELL) $(srcroot)/depcomp
 
 # Note that these are overridden by GNU make-specific code below if
 # GNU make is used.  The overrides implement dependency tracking.
-COMPILE.pre = $(CC)
+COMPILE.pre = $(CC) $(C_DIALECT)
 COMPILE.post = -c -o $@
 COMPILE = $(COMPILE.pre) $(ALL_CFLAGS) $(COMPILE.post)
 POSTCOMPILE = @true
@@ -126,12 +124,8 @@ SIM_EXTRA_DEPS =
 SIM_EXTRA_CFLAGS =
 # List of extra libraries to link with.
 SIM_EXTRA_LIBS =
-# List of extra program dependencies.
-SIM_EXTRA_LIBDEPS =
 # List of main object files for `run'.
 SIM_RUN_OBJS = nrun.o
-# Dependency of `all' to build any extra files.
-SIM_EXTRA_ALL =
 # Dependency of `install' to install any extra files.
 SIM_EXTRA_INSTALL =
 # Dependency of `clean' to clean any extra files.
@@ -229,8 +223,7 @@ CONFIG_CFLAGS = \
        $(SIM_WARN_CFLAGS) \
        $(SIM_WERROR_CFLAGS) \
        $(SIM_HARDWARE) \
-       $(SIM_EXTRA_CFLAGS) \
-       $(HDEFINES) $(TDEFINES)
+       $(SIM_EXTRA_CFLAGS)
 CSEARCH = -I. -I$(srcdir) -I../common -I$(srccom) \
   -I../../include -I$(srcroot)/include \
   -I../../bfd -I$(srcroot)/bfd \
@@ -249,19 +242,21 @@ OPCODES_LIB = ../../opcodes/libopcodes.a
 LIBINTL = @LIBINTL@
 LIBINTL_DEP = @LIBINTL_DEP@
 CONFIG_LIBS = @LIBS@ $(ZLIB)
-LIBDEPS = $(BFD_LIB) $(OPCODES_LIB) $(LIBINTL_DEP) $(LIBIBERTY_LIB) \
-       $(SIM_EXTRA_LIBDEPS)
+LIBDEPS = $(BFD_LIB) $(OPCODES_LIB) $(LIBINTL_DEP) $(LIBIBERTY_LIB)
 EXTRA_LIBS = $(BFD_LIB) $(OPCODES_LIB) $(LIBINTL) $(LIBIBERTY_LIB) \
        $(CONFIG_LIBS) $(SIM_EXTRA_LIBS) $(LIBDL)
 
 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
 remote_sim_h = $(srcroot)/include/gdb/remote-sim.h
 
-all: $(SIM_EXTRA_ALL) libsim.a run$(EXEEXT) .gdbinit
+all: libsim.a run$(EXEEXT) .gdbinit
 
 libsim.a: $(LIB_OBJS)
        rm -f libsim.a
@@ -277,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
@@ -290,8 +288,9 @@ stamp-tvals: gentmap
        touch stamp-tvals
 
 version.c: Makefile $(srcroot)/gdb/version.in $(srcroot)/bfd/version.h $(srcroot)/sim/common/create-version.sh
-       $(SHELL) $(srcroot)/sim/common/create-version.sh $(srcroot)/gdb \
-           $(host_alias) $(target_alias) version.c
+       $(SHELL) $(srcroot)/sim/common/create-version.sh $(srcroot)/gdb $@.tmp
+       $(SHELL) $(srcroot)/move-if-change $@.tmp $@
+       touch $@
 
 #
 # Rules for building sim-* components.  Triggered by listing the corresponding
@@ -478,7 +477,6 @@ installdirs:
        $(SHELL) $(srcdir)/../../mkinstalldirs $(DESTDIR)$(libdir)
 
 check:
-       cd ../testsuite && $(MAKE) check RUNTESTFLAGS="$(RUNTESTFLAGS)"
 
 info:
 clean-info: