Use HOST_CC, default CC, to compile findprim.
authorTaylor R Campbell <campbell@mumble.net>
Fri, 11 Jan 2019 04:45:19 +0000 (04:45 +0000)
committerTaylor R Campbell <campbell@mumble.net>
Fri, 11 Jan 2019 04:45:20 +0000 (04:45 +0000)
This needs to run on the host system, not on the target system.

This way we can cross-compile the microcode if you have a C
cross-compiler handy, which makes iterating development a lot faster
when the target's native C compiler is painfully slow.

src/microcode/configure.ac
src/microcode/makegen/Makefile.in.in

index ed078bc93838ed607c42beb9182e190a5514400e..5c2ca51cdf57ddf780d9d30d5adc9468b524eb96 100644 (file)
@@ -203,6 +203,8 @@ AC_PROG_INSTALL
 AC_PROG_LN_S
 AC_PROG_MAKE_SET
 
+: ${HOST_CC:=${CC}}
+
 if test x"${GCC}" = xyes; then
 
     dnl Discard flags computed by AC_PROG_CC; we'll use our own.
@@ -928,6 +930,7 @@ AC_SUBST([AUXDIR_NAME])
 AC_SUBST([EXE_NAME])
 AC_SUBST([INSTALL_INCLUDE])
 AC_SUBST([CCLD])
+AC_SUBST([HOST_CC])
 
 AC_CONFIG_FILES([Makefile])
 AC_OUTPUT
index 3124b5fc7702f931bfe0a40b8bd8d5a5fc05753c..aafac46b403beb13efd0f0f59d509b0c084b6ae2 100644 (file)
@@ -69,6 +69,7 @@ EXE_NAME = @EXE_NAME@
 AUXDIR = $(libdir)/$(AUXDIR_NAME)
 
 CC = @CC@
+HOST_CC = @HOST_CC@
 CCLD = @CCLD@
 M4 = $(srcdir)/makegen/m4.sh @M4@
 AS = as
@@ -172,7 +173,11 @@ usrdef.c: $(STD_SOURCES) findprim Makefile
 
 findprim: $(findprim_OBJECTS) $(findprim_DEPENDENCIES)
        -rm -f $@
-       $(LINK) $(findprim_LDFLAGS) $(findprim_OBJECTS) $(findprim_LIBS)
+       $(HOST_CC) -o $@ $(findprim_LDFLAGS) $(findprim_OBJECTS) \
+               $(findprim_LIBS)
+
+findprim.o: findprim.c config.h
+       $(HOST_CC) -o $@ $(findprim_CFLAGS) -c findprim.c
 
 gen-nonce: gen-nonce.o
        $(LINK) gen-nonce.o