Merge pull request #135 from udif/cross_compile
Fixed cross-compile using mingw 64 bit under Windows 10 Linux subsyst…
This commit is contained in:
commit
a518d594d2
13
Makefile.in
13
Makefile.in
|
|
@ -70,7 +70,8 @@ dllib=@DLLIB@
|
||||||
HOSTCC = @CC@
|
HOSTCC = @CC@
|
||||||
HOSTCFLAGS = @WARNING_FLAGS@ @WARNING_FLAGS_CC@ @CFLAGS@
|
HOSTCFLAGS = @WARNING_FLAGS@ @WARNING_FLAGS_CC@ @CFLAGS@
|
||||||
|
|
||||||
CC = @CC@
|
BUILDCC = @CC_FOR_BUILD@
|
||||||
|
BUILDEXT = @BUILD_EXEEXT@
|
||||||
CXX = @CXX@
|
CXX = @CXX@
|
||||||
DLLTOOL = @DLLTOOL@
|
DLLTOOL = @DLLTOOL@
|
||||||
INSTALL = @INSTALL@
|
INSTALL = @INSTALL@
|
||||||
|
|
@ -127,9 +128,9 @@ all: dep config.h _pli_types.h version_tag.h ivl@EXEEXT@ version.exe iverilog-vp
|
||||||
# In the windows world, the installer will need a dosify program to
|
# In the windows world, the installer will need a dosify program to
|
||||||
# dosify text files.
|
# dosify text files.
|
||||||
ifeq (@MINGW32@,yes)
|
ifeq (@MINGW32@,yes)
|
||||||
all: dosify.exe
|
all: dosify$(BUILDEXT)
|
||||||
dosify.exe: $(srcdir)/dosify.c
|
dosify$(BUILDEXT): $(srcdir)/dosify.c
|
||||||
$(HOSTCC) $(HOSTCFLAGS) -o dosify.exe $(srcdir)/dosify.c
|
$(BUILDCC) $(CFLAGS) -o dosify$(BUILDEXT) $(srcdir)/dosify.c
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# This rule rules the compiler in the trivial hello.vl program to make
|
# This rule rules the compiler in the trivial hello.vl program to make
|
||||||
|
|
@ -156,7 +157,7 @@ clean:
|
||||||
$(foreach dir,$(SUBDIRS),$(MAKE) -C $(dir) $@ && ) true
|
$(foreach dir,$(SUBDIRS),$(MAKE) -C $(dir) $@ && ) true
|
||||||
rm -f *.o parse.cc parse.h lexor.cc
|
rm -f *.o parse.cc parse.h lexor.cc
|
||||||
rm -f ivl.exp iverilog-vpi.man iverilog-vpi.pdf iverilog-vpi.ps
|
rm -f ivl.exp iverilog-vpi.man iverilog-vpi.pdf iverilog-vpi.ps
|
||||||
rm -f parse.output syn-rules.output dosify.exe ivl@EXEEXT@ check.vvp
|
rm -f parse.output syn-rules.output dosify$(BUILDEXT) ivl@EXEEXT@ check.vvp
|
||||||
rm -f lexor_keyword.cc libivl.a libvpi.a iverilog-vpi syn-rules.cc
|
rm -f lexor_keyword.cc libivl.a libvpi.a iverilog-vpi syn-rules.cc
|
||||||
rm -rf dep
|
rm -rf dep
|
||||||
rm -f version.exe
|
rm -f version.exe
|
||||||
|
|
@ -239,7 +240,7 @@ iverilog-vpi: $(srcdir)/iverilog-vpi.sh Makefile
|
||||||
endif
|
endif
|
||||||
|
|
||||||
version.exe: $(srcdir)/version.c $(srcdir)/version_base.h version_tag.h
|
version.exe: $(srcdir)/version.c $(srcdir)/version_base.h version_tag.h
|
||||||
$(HOSTCC) $(HOSTCFLAGS) -o version.exe -I. -I$(srcdir) $(srcdir)/version.c
|
$(BUILDCC) $(CFLAGS) -o version.exe -I. -I$(srcdir) $(srcdir)/version.c
|
||||||
|
|
||||||
%.o: %.cc config.h
|
%.o: %.cc config.h
|
||||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) @DEPENDENCY_FLAG@ -c $< -o $*.o
|
$(CXX) $(CPPFLAGS) $(CXXFLAGS) @DEPENDENCY_FLAG@ -c $< -o $*.o
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@ system and C/C++ compilation should be able to build the source
|
||||||
distribution with little effort. Some actual programming skills are
|
distribution with little effort. Some actual programming skills are
|
||||||
not required, but helpful in case of problems.
|
not required, but helpful in case of problems.
|
||||||
|
|
||||||
If you are building for Windows, see the mingw.txt file.
|
If you are building on Windows, see the mingw.txt file.
|
||||||
|
|
||||||
2.1 Compile Time Prerequisites
|
2.1 Compile Time Prerequisites
|
||||||
|
|
||||||
|
|
@ -112,6 +112,12 @@ configure script that modify its behavior:
|
||||||
with the same prefix but different suffix are guaranteed
|
with the same prefix but different suffix are guaranteed
|
||||||
to not interfere with each other.
|
to not interfere with each other.
|
||||||
|
|
||||||
|
--host=<host-type>
|
||||||
|
Compile iverilog for a different platform. You can use:
|
||||||
|
x64_64-w64-mingw32 for building 64-bit Windows executables
|
||||||
|
i686-w64-mingw32 for building 32-bit Windows executables
|
||||||
|
Both options require installing the required mingw-w64 packages.
|
||||||
|
|
||||||
2.3 (Optional) Testing
|
2.3 (Optional) Testing
|
||||||
|
|
||||||
To run a simple test before installation, execute
|
To run a simple test before installation, execute
|
||||||
|
|
|
||||||
|
|
@ -225,7 +225,9 @@ AC_DEFUN([AX_C99_STRTOD],
|
||||||
[# On MinGW we need to jump through hoops to get a C99 compliant strtod().
|
[# On MinGW we need to jump through hoops to get a C99 compliant strtod().
|
||||||
# mingw-w64 doesn't need this, and the 64-bit version doesn't support it.
|
# mingw-w64 doesn't need this, and the 64-bit version doesn't support it.
|
||||||
case "${host}" in
|
case "${host}" in
|
||||||
*-pc-mingw32)
|
x86_64-w64-mingw32)
|
||||||
|
;;
|
||||||
|
*-*-mingw32)
|
||||||
LDFLAGS+=" -Wl,--undefined=___strtod,--wrap,strtod,--defsym,___wrap_strtod=___strtod"
|
LDFLAGS+=" -Wl,--undefined=___strtod,--wrap,strtod,--defsym,___wrap_strtod=___strtod"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
@ -244,3 +246,130 @@ _config_header=$1
|
||||||
_stamp_name=stamp-`expr //$_config_header : '.*/\([[^./]]*\)\.[[^./]]*$'`-h
|
_stamp_name=stamp-`expr //$_config_header : '.*/\([[^./]]*\)\.[[^./]]*$'`-h
|
||||||
echo "timestamp for $_config_header" > `AS_DIRNAME(["$_config_header"])`/[]$_stamp_name
|
echo "timestamp for $_config_header" > `AS_DIRNAME(["$_config_header"])`/[]$_stamp_name
|
||||||
]) #_AC_AM_CONFIG_HEADER_HOOK
|
]) #_AC_AM_CONFIG_HEADER_HOOK
|
||||||
|
|
||||||
|
# ===========================================================================
|
||||||
|
# http://www.gnu.org/software/autoconf-archive/ax_prog_cc_for_build.html
|
||||||
|
# ===========================================================================
|
||||||
|
#
|
||||||
|
# SYNOPSIS
|
||||||
|
#
|
||||||
|
# AX_PROG_CC_FOR_BUILD
|
||||||
|
#
|
||||||
|
# DESCRIPTION
|
||||||
|
#
|
||||||
|
# This macro searches for a C compiler that generates native executables,
|
||||||
|
# that is a C compiler that surely is not a cross-compiler. This can be
|
||||||
|
# useful if you have to generate source code at compile-time like for
|
||||||
|
# example GCC does.
|
||||||
|
#
|
||||||
|
# The macro sets the CC_FOR_BUILD and CPP_FOR_BUILD macros to anything
|
||||||
|
# needed to compile or link (CC_FOR_BUILD) and preprocess (CPP_FOR_BUILD).
|
||||||
|
# The value of these variables can be overridden by the user by specifying
|
||||||
|
# a compiler with an environment variable (like you do for standard CC).
|
||||||
|
#
|
||||||
|
# It also sets BUILD_EXEEXT and BUILD_OBJEXT to the executable and object
|
||||||
|
# file extensions for the build platform, and GCC_FOR_BUILD to `yes' if
|
||||||
|
# the compiler we found is GCC. All these variables but GCC_FOR_BUILD are
|
||||||
|
# substituted in the Makefile.
|
||||||
|
#
|
||||||
|
# LICENSE
|
||||||
|
#
|
||||||
|
# Copyright (c) 2008 Paolo Bonzini <bonzini@gnu.org>
|
||||||
|
#
|
||||||
|
# Copying and distribution of this file, with or without modification, are
|
||||||
|
# permitted in any medium without royalty provided the copyright notice
|
||||||
|
# and this notice are preserved. This file is offered as-is, without any
|
||||||
|
# warranty.
|
||||||
|
|
||||||
|
#serial 8
|
||||||
|
|
||||||
|
AU_ALIAS([AC_PROG_CC_FOR_BUILD], [AX_PROG_CC_FOR_BUILD])
|
||||||
|
AC_DEFUN([AX_PROG_CC_FOR_BUILD], [dnl
|
||||||
|
AC_REQUIRE([AC_PROG_CC])dnl
|
||||||
|
AC_REQUIRE([AC_PROG_CPP])dnl
|
||||||
|
AC_REQUIRE([AC_EXEEXT])dnl
|
||||||
|
AC_REQUIRE([AC_CANONICAL_HOST])dnl
|
||||||
|
|
||||||
|
dnl Use the standard macros, but make them use other variable names
|
||||||
|
dnl
|
||||||
|
pushdef([ac_cv_prog_CPP], ac_cv_build_prog_CPP)dnl
|
||||||
|
pushdef([ac_cv_prog_gcc], ac_cv_build_prog_gcc)dnl
|
||||||
|
pushdef([ac_cv_prog_cc_works], ac_cv_build_prog_cc_works)dnl
|
||||||
|
pushdef([ac_cv_prog_cc_cross], ac_cv_build_prog_cc_cross)dnl
|
||||||
|
pushdef([ac_cv_prog_cc_g], ac_cv_build_prog_cc_g)dnl
|
||||||
|
pushdef([ac_cv_exeext], ac_cv_build_exeext)dnl
|
||||||
|
pushdef([ac_cv_objext], ac_cv_build_objext)dnl
|
||||||
|
pushdef([ac_exeext], ac_build_exeext)dnl
|
||||||
|
pushdef([ac_objext], ac_build_objext)dnl
|
||||||
|
pushdef([CC], CC_FOR_BUILD)dnl
|
||||||
|
pushdef([CPP], CPP_FOR_BUILD)dnl
|
||||||
|
pushdef([CFLAGS], CFLAGS_FOR_BUILD)dnl
|
||||||
|
pushdef([CPPFLAGS], CPPFLAGS_FOR_BUILD)dnl
|
||||||
|
pushdef([LDFLAGS], LDFLAGS_FOR_BUILD)dnl
|
||||||
|
pushdef([host], build)dnl
|
||||||
|
pushdef([host_alias], build_alias)dnl
|
||||||
|
pushdef([host_cpu], build_cpu)dnl
|
||||||
|
pushdef([host_vendor], build_vendor)dnl
|
||||||
|
pushdef([host_os], build_os)dnl
|
||||||
|
pushdef([ac_cv_host], ac_cv_build)dnl
|
||||||
|
pushdef([ac_cv_host_alias], ac_cv_build_alias)dnl
|
||||||
|
pushdef([ac_cv_host_cpu], ac_cv_build_cpu)dnl
|
||||||
|
pushdef([ac_cv_host_vendor], ac_cv_build_vendor)dnl
|
||||||
|
pushdef([ac_cv_host_os], ac_cv_build_os)dnl
|
||||||
|
pushdef([ac_cpp], ac_build_cpp)dnl
|
||||||
|
pushdef([ac_compile], ac_build_compile)dnl
|
||||||
|
pushdef([ac_link], ac_build_link)dnl
|
||||||
|
|
||||||
|
save_cross_compiling=$cross_compiling
|
||||||
|
save_ac_tool_prefix=$ac_tool_prefix
|
||||||
|
cross_compiling=no
|
||||||
|
ac_tool_prefix=
|
||||||
|
|
||||||
|
AC_PROG_CC
|
||||||
|
AC_PROG_CPP
|
||||||
|
AC_EXEEXT
|
||||||
|
|
||||||
|
ac_tool_prefix=$save_ac_tool_prefix
|
||||||
|
cross_compiling=$save_cross_compiling
|
||||||
|
|
||||||
|
dnl Restore the old definitions
|
||||||
|
dnl
|
||||||
|
popdef([ac_link])dnl
|
||||||
|
popdef([ac_compile])dnl
|
||||||
|
popdef([ac_cpp])dnl
|
||||||
|
popdef([ac_cv_host_os])dnl
|
||||||
|
popdef([ac_cv_host_vendor])dnl
|
||||||
|
popdef([ac_cv_host_cpu])dnl
|
||||||
|
popdef([ac_cv_host_alias])dnl
|
||||||
|
popdef([ac_cv_host])dnl
|
||||||
|
popdef([host_os])dnl
|
||||||
|
popdef([host_vendor])dnl
|
||||||
|
popdef([host_cpu])dnl
|
||||||
|
popdef([host_alias])dnl
|
||||||
|
popdef([host])dnl
|
||||||
|
popdef([LDFLAGS])dnl
|
||||||
|
popdef([CPPFLAGS])dnl
|
||||||
|
popdef([CFLAGS])dnl
|
||||||
|
popdef([CPP])dnl
|
||||||
|
popdef([CC])dnl
|
||||||
|
popdef([ac_objext])dnl
|
||||||
|
popdef([ac_exeext])dnl
|
||||||
|
popdef([ac_cv_objext])dnl
|
||||||
|
popdef([ac_cv_exeext])dnl
|
||||||
|
popdef([ac_cv_prog_cc_g])dnl
|
||||||
|
popdef([ac_cv_prog_cc_cross])dnl
|
||||||
|
popdef([ac_cv_prog_cc_works])dnl
|
||||||
|
popdef([ac_cv_prog_gcc])dnl
|
||||||
|
popdef([ac_cv_prog_CPP])dnl
|
||||||
|
|
||||||
|
dnl Finally, set Makefile variables
|
||||||
|
dnl
|
||||||
|
BUILD_EXEEXT=$ac_build_exeext
|
||||||
|
BUILD_OBJEXT=$ac_build_objext
|
||||||
|
AC_SUBST(BUILD_EXEEXT)dnl
|
||||||
|
AC_SUBST(BUILD_OBJEXT)dnl
|
||||||
|
AC_SUBST([CFLAGS_FOR_BUILD])dnl
|
||||||
|
AC_SUBST([CPPFLAGS_FOR_BUILD])dnl
|
||||||
|
AC_SUBST([LDFLAGS_FOR_BUILD])dnl
|
||||||
|
])
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -224,8 +224,8 @@ case "${host}" in
|
||||||
CFLAGS="-mieee $CFLAGS"
|
CFLAGS="-mieee $CFLAGS"
|
||||||
;;
|
;;
|
||||||
*-*-mingw*)
|
*-*-mingw*)
|
||||||
CXXFLAGS="-D__USE_MINGW_ANSI_STDIO=1 $CXXFLAGS"
|
CXXFLAGS="-Wno-deprecated-declarations -Wno-sign-compare -D__USE_MINGW_ANSI_STDIO=1 $CXXFLAGS"
|
||||||
CFLAGS="-D__USE_MINGW_ANSI_STDIO=1 $CFLAGS"
|
CFLAGS="-Wno-sign-compare -D__USE_MINGW_ANSI_STDIO=1 $CFLAGS"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
|
@ -325,5 +325,5 @@ then
|
||||||
AC_MSG_ERROR(cannot configure white space in libdir: $libdir)
|
AC_MSG_ERROR(cannot configure white space in libdir: $libdir)
|
||||||
fi
|
fi
|
||||||
AC_MSG_RESULT(ok)
|
AC_MSG_RESULT(ok)
|
||||||
|
AX_PROG_CC_FOR_BUILD
|
||||||
AC_OUTPUT(Makefile ivlpp/Makefile vhdlpp/Makefile vvp/Makefile vpi/Makefile driver/Makefile driver-vpi/Makefile cadpli/Makefile libveriuser/Makefile tgt-null/Makefile tgt-stub/Makefile tgt-vvp/Makefile tgt-vhdl/Makefile tgt-fpga/Makefile tgt-verilog/Makefile tgt-pal/Makefile tgt-vlog95/Makefile tgt-pcb/Makefile tgt-blif/Makefile tgt-sizer/Makefile)
|
AC_OUTPUT(Makefile ivlpp/Makefile vhdlpp/Makefile vvp/Makefile vpi/Makefile driver/Makefile driver-vpi/Makefile cadpli/Makefile libveriuser/Makefile tgt-null/Makefile tgt-stub/Makefile tgt-vvp/Makefile tgt-vhdl/Makefile tgt-fpga/Makefile tgt-verilog/Makefile tgt-pal/Makefile tgt-vlog95/Makefile tgt-pcb/Makefile tgt-blif/Makefile tgt-sizer/Makefile)
|
||||||
|
|
|
||||||
|
|
@ -36,6 +36,7 @@ mandir = @mandir@
|
||||||
dllib=@DLLIB@
|
dllib=@DLLIB@
|
||||||
|
|
||||||
CC = @CC@
|
CC = @CC@
|
||||||
|
HOSTCC := @CC@
|
||||||
WINDRES = @WINDRES@
|
WINDRES = @WINDRES@
|
||||||
INSTALL = @INSTALL@
|
INSTALL = @INSTALL@
|
||||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||||
|
|
@ -97,6 +98,11 @@ install: all installdirs $(bindir)/iverilog-vpi$(suffix)@EXEEXT@
|
||||||
|
|
||||||
$(bindir)/iverilog-vpi$(suffix)@EXEEXT@: ./iverilog-vpi@EXEEXT@
|
$(bindir)/iverilog-vpi$(suffix)@EXEEXT@: ./iverilog-vpi@EXEEXT@
|
||||||
$(INSTALL_PROGRAM) ./iverilog-vpi@EXEEXT@ "$(bindir)/iverilog-vpi$(suffix)@EXEEXT@"
|
$(INSTALL_PROGRAM) ./iverilog-vpi@EXEEXT@ "$(bindir)/iverilog-vpi$(suffix)@EXEEXT@"
|
||||||
|
ifeq (@WIN32@,yes)
|
||||||
|
$(INSTALL_PROGRAM) $(shell $(HOSTCC) --print-file-name=libwinpthread-1.dll) "$(DESTDIR)$(bindir)"
|
||||||
|
$(INSTALL_PROGRAM) $(shell $(HOSTCC) --print-file-name=libgcc_s_sjlj-1.dll) "$(DESTDIR)$(bindir)"
|
||||||
|
$(INSTALL_PROGRAM) $(shell $(HOSTCC) --print-file-name=libstdc++-6.dll) "$(DESTDIR)$(bindir)"
|
||||||
|
endif
|
||||||
|
|
||||||
installdirs: $(srcdir)/../mkinstalldirs
|
installdirs: $(srcdir)/../mkinstalldirs
|
||||||
$(srcdir)/../mkinstalldirs "$(bindir)"
|
$(srcdir)/../mkinstalldirs "$(bindir)"
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,8 @@ includedir = @includedir@
|
||||||
HOSTCC = @CC@
|
HOSTCC = @CC@
|
||||||
HOSTCFLAGS = @WARNING_FLAGS@ @WARNING_FLAGS_CC@ @CFLAGS@
|
HOSTCFLAGS = @WARNING_FLAGS@ @WARNING_FLAGS_CC@ @CFLAGS@
|
||||||
|
|
||||||
CC = @CC@
|
BUILDCC = @CC_FOR_BUILD@
|
||||||
|
BUILDEXT = @BUILD_EXEEXT@
|
||||||
CXX = @CXX@
|
CXX = @CXX@
|
||||||
DLLTOOL = @DLLTOOL@
|
DLLTOOL = @DLLTOOL@
|
||||||
AR = @AR@
|
AR = @AR@
|
||||||
|
|
@ -153,9 +154,9 @@ endif
|
||||||
mv $*.d dep/$*.d
|
mv $*.d dep/$*.d
|
||||||
|
|
||||||
tables.cc: $(srcdir)/draw_tt.c
|
tables.cc: $(srcdir)/draw_tt.c
|
||||||
$(HOSTCC) $(HOSTCFLAGS) -o draw_tt.exe $(srcdir)/draw_tt.c
|
$(CC) $(CFLAGS) -o draw_tt$(BUILDEXT) $(srcdir)/draw_tt.c
|
||||||
./draw_tt.exe > tables.cc
|
./draw_tt$(BUILDEXT) > tables.cc
|
||||||
rm draw_tt.exe
|
rm draw_tt$(BUILDEXT)
|
||||||
|
|
||||||
lexor.o: lexor.cc parse.h
|
lexor.o: lexor.cc parse.h
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue