-
Notifications
You must be signed in to change notification settings - Fork 32
Improve build system to detect available compilers #17
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
* text=auto | ||
|
||
findwinsdk text eol=lf | ||
msvs-detect text eol=lf | ||
checkenv text eol=lf | ||
configure text eol=lf | ||
configure.ac text eol=lf |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,41 +1,14 @@ | ||
VERSION = 0.34 | ||
all: flexlink.exe support | ||
|
||
include $(shell cygpath -ad "$(shell ocamlopt -where)/Makefile.config") | ||
|
||
MINGW_PREFIX = i686-w64-mingw32 | ||
MINCC = $(MINGW_PREFIX)-gcc | ||
|
||
MINGW64_PREFIX = x86_64-w64-mingw32 | ||
MIN64CC = $(MINGW64_PREFIX)-gcc | ||
|
||
CYGWIN_PREFIX = i686-pc-cygwin | ||
CYGCC = $(CYGWIN_PREFIX)-gcc | ||
|
||
CYGWIN64_PREFIX = x86_64-pc-cygwin | ||
CYG64CC = $(CYGWIN64_PREFIX)-gcc | ||
|
||
.PHONY: version.ml | ||
version.ml: | ||
echo "let version = \"$(VERSION)\"" > version.ml | ||
echo "let mingw_prefix = \"$(MINGW_PREFIX)\"" >> version.ml | ||
echo "let mingw64_prefix = \"$(MINGW64_PREFIX)\"" >> version.ml | ||
|
||
# Supported tool-chains | ||
|
||
CHAINS = mingw mingw64 cygwin cygwin64 msvc msvc64 | ||
|
||
# Compilers | ||
ifeq ($(findstring clean,$(MAKECMDGOALS)),) | ||
include Makefile.config | ||
endif | ||
|
||
# Attempt to locate the Windows SDK | ||
all: $(if $(filter-out no,$(HAVE_OCAMLOPT)),flexlink.exe) support | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This has the nice benefit if bootstrapping just the FlexDLL objects that |
||
|
||
ifeq ($(findstring clean,$(MAKECMDGOALS)),) | ||
include Makefile.winsdk | ||
ifneq ($(filter-out no,$(HAVE_OCAMLOPT)),) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Eliminates the warning about |
||
include $(shell cygpath -ad "$(shell ocamlopt -where)/Makefile.config") | ||
endif | ||
|
||
Makefile.winsdk: findwinsdk | ||
bash ./findwinsdk x86 > $@ | ||
bash ./findwinsdk x64 64 >> $@ | ||
# Compilers | ||
|
||
MSVC_DETECT=1 | ||
MSVC_FLAGS=/nologo /MD -D_CRT_SECURE_NO_DEPRECATE /GS- | ||
|
@@ -47,38 +20,18 @@ MSVC64_PREFIX= | |
MSVCC=cl.exe $(MSVC_FLAGS) | ||
MSVCC64=cl.exe $(MSVC_FLAGS) | ||
else | ||
ifeq ($(SDK),) | ||
# Otherwise, assume the 32-bit version of VS 2008 or Win7 SDK is in the path. | ||
|
||
MSVCC_ROOT := $(shell which cl.exe 2>/dev/null | cygpath -f - -ad | xargs -d \\n dirname 2>/dev/null | cygpath -f - -m) | ||
MSVC_LIB1 = $(shell dirname $(MSVCC_ROOT)) | ||
MSVC_LIB2 = $(shell which ResGen.exe | cygpath -f - -ad | xargs -d \\n dirname | xargs -d \\n dirname | cygpath -f - -m) | ||
MSVC_LIB = $(MSVC_LIB1)/Lib;$(MSVC_LIB2)/Lib | ||
MSVC_INCLUDE = $(MSVC_LIB1)/Include;$(MSVC_LIB2)/Include | ||
MSVC_PREFIX=LIB="$(MSVC_LIB)" INCLUDE="$(MSVC_INCLUDE)" | ||
|
||
MSVC64_LIB = $(MSVC_LIB1)/Lib/amd64;$(MSVC_LIB2)/Lib/x64 | ||
MSVC64_PREFIX=LIB="$(MSVC64_LIB)" INCLUDE="$(MSVC_INCLUDE)" | ||
|
||
MSVCC = $(MSVCC_ROOT)/cl.exe $(MSVC_FLAGS) | ||
MSVCC64 = $(MSVCC_ROOT)/amd64/cl.exe $(MSVC_FLAGS) | ||
else | ||
MSVCC_ROOT:= | ||
MSVC_PREFIX=PATH="$(SDK):$(PATH)" LIB="$(SDK_LIB);$(LIB)" INCLUDE="$(SDK_INC);$(INCLUDE)" | ||
MSVC64_PREFIX=PATH="$(SDK64):$(PATH)" LIB="$(SDK64_LIB);$(LIB)" INCLUDE="$(SDK64_INC);$(INCLUDE)" | ||
# Otherwise, use configured values | ||
MSVC_PREFIX=PATH="$(MSVS_PATH)$(PATH)" LIB="$(MSVS_LIB);$(LIB)" INCLUDE="$(MSVS_INC);$(INCLUDE)" | ||
MSVC64_PREFIX=PATH="$(MSVS64_PATH)$(PATH)" LIB="$(MSVS64_LIB);$(LIB)" INCLUDE="$(MSVS64_INC);$(INCLUDE)" | ||
|
||
MSVCC = cl.exe $(MSVC_FLAGS) | ||
MSVCC64 = cl.exe $(MSVC_FLAGS) | ||
endif | ||
endif | ||
|
||
ifeq ($(MSVS_DETECT),1) | ||
show_root: | ||
ifeq ($(MSVCC_ROOT),) | ||
@echo "$(SDK)" | ||
@echo "$(SDK_LIB)" | ||
else | ||
@echo "$(MSVCC_ROOT)" | ||
@echo "$(MSVC_LIB)" | ||
@echo "$(MSVS_PATH)" | ||
@echo "$(MSVS_LIB)" | ||
endif | ||
|
||
OCAMLOPT = ocamlopt | ||
|
@@ -190,10 +143,11 @@ demo_msvc64: flexlink.exe flexdll_msvc64.obj flexdll_initer_msvc64.obj | |
(cd test && $(MSVC64_PREFIX) $(MAKE) clean demo CHAIN=msvc64 CC="$(MSVCC64)" O=obj) | ||
|
||
distclean: clean | ||
rm -f Makefile.winsdk | ||
rm -f Makefile.config config.log config.status version.ml | ||
rm -rf autom4te.cache | ||
|
||
clean: | ||
rm -f *.obj *.o *.lib *.a *.exe *.opt *.cmx *.dll *.exp *.cmi *.cmo *~ version.res version.ml | ||
rm -f *.obj *.o *.lib *.a *.exe *.opt *.cmx *.dll *.exp *.cmi *.cmo *~ version.res | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
cd test && $(MAKE) clean | ||
|
||
|
||
|
@@ -204,8 +158,6 @@ URL = frisch@frisch.fr:www/flexdll/ | |
|
||
# Source packages | ||
|
||
PACKAGE = flexdll-$(VERSION).tar.gz | ||
|
||
package_src: | ||
rm -Rf flexdll-$(VERSION) | ||
mkdir flexdll-$(VERSION) | ||
|
@@ -266,3 +218,9 @@ upload_installer: | |
|
||
upload_all: | ||
$(MAKE) upload_src upload_bin installer upload_installer | ||
|
||
Makefile.config: Makefile.config.in configure | ||
./configure | ||
|
||
configure: configure.ac | ||
autoconf |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
VERSION = @PACKAGE_VERSION@ | ||
|
||
PACKAGE = @PACKAGE_TARNAME@-@PACKAGE_VERSION@.tar.gz | ||
|
||
MINGW_PREFIX=@MINGW_PREFIX@ | ||
MINCC=@MINCC@ | ||
MINGW64_PREFIX=@MINGW64_PREFIX@ | ||
MIN64CC=@MIN64CC@ | ||
CYGCC=@CYGCC@ | ||
CYG64CC=@CYG64CC@ | ||
|
||
MSVS_PATH=@MSVS_PATH@ | ||
MSVS_INC=@MSVS_INC@ | ||
MSVS_LIB=@MSVS_LIB@ | ||
MSVS64_PATH=@MSVS64_PATH@ | ||
MSVS64_INC=@MSVS64_INC@ | ||
MSVS64_LIB=@MSVS64_LIB@ | ||
|
||
# Supported tool-chains | ||
|
||
CHAINS =@CHAINS@ | ||
|
||
HAVE_OCAMLOPT = @HAVE_OCAMLOPT@ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Avoids running
configure
ifmake [dist]clean
is called twice.