113
113
#################### variables depending on your OCaml-installation
115
SYSTEM := $(shell ocamlc -config 2>/dev/null | grep system | sed 's/system: //')
120
# - some other string means Unix
121
# - empty means ocamlc does not support -config
123
ifeq ($(SYSTEM),mingw)
126
ifeq ($(SYSTEM),win32)
133
# We are compiling with cygwin tools:
118
134
CFLAGS_WIN32 := -mno-cygwin
135
# The default value 'cc' makes 'ocamlc -cc "cc"' raises the error 'The
136
# NTVDM CPU has encountered an illegal instruction'.
138
# The OCaml C header files use this flag:
139
CFLAGS += -D__MINGW32__
489
510
NONEXECS := $(INTF) $(IMPL_CMO) $(IMPL_CMX) $(IMPL_ASM) $(IMPL_S) \
490
511
$(OBJ_FILES) $(PRE_TARGETS) $(BCRESULT).cma $(NCRESULT).cmxa \
491
512
$(NCRESULT).$(EXT_LIB) $(BCRESULT).cmi $(BCRESULT).cmo \
492
$(NCRESULT).cmi $(NCRESULT).cmx $(NCRESULT).o \
513
$(NCRESULT).cmi $(NCRESULT).cmx $(NCRESULT).$(EXT_OBJ) \
493
514
$(RES_CLIB) $(IMPL_CMO:.cmo=.annot) \
494
$(LIB_PACK_NAME).cmi $(LIB_PACK_NAME).cmo $(LIB_PACK_NAME).cmx $(LIB_PACK_NAME).o
515
$(LIB_PACK_NAME).cmi $(LIB_PACK_NAME).cmo $(LIB_PACK_NAME).cmx \
516
$(LIB_PACK_NAME).$(EXT_OBJ)
497
519
NONEXECS += $(DLLSONAME)
591
613
ifdef LIB_PACK_NAME
592
FOR_PACK_NAME := $(shell echo $(LIB_PACK_NAME) | sed -e 's/^\(.\)/\U\1/')
614
FOR_PACK_NAME := $(shell echo $(LIB_PACK_NAME) | awk '{print toupper(substr($$0,1,1))substr($$0,2)}')
595
617
# If we have to make byte-code
890
912
# packs native-code objects
891
913
pack-native-code: $(PRE_TARGETS)
892
914
$(QUIET)$(MAKE) -r -f $(OCAMLMAKEFILE) \
893
$(NCRESULT).cmx $(NCRESULT).o \
915
$(NCRESULT).cmx $(NCRESULT).$(EXT_OBJ) \
894
916
REAL_RESULT="$(NCRESULT)" \
895
917
REAL_OCAMLC="$(OCAMLOPT)" \
896
918
PACK_LIB=yes make_deps=yes
965
# From OCaml 3.11.0, ocamlmklib is available on windows
966
OCAMLMLIB_EXISTS = $(shell which $(OCAMLMKLIB))
967
ifeq ($(strip $(OCAMLMLIB_EXISTS)),)
943
968
$(DLLSONAME): $(OBJ_LINK)
944
969
$(CC) $(CFLAGS) $(CFLAGS_WIN32) $(OBJ_LINK) -shared -o $@ \
945
-Wl,--whole-archive $(wildcard $(foreach dir,$(LIBDIRS),$(CLIBS:%=$(dir)/lib%.a))) \
946
$(OCAMLLIBPATH)/ocamlrun.a \
970
$(wildcard $(foreach dir,$(LIBDIRS),$(CLIBS:%=$(dir)/lib%.a))) \
971
'$(OCAMLLIBPATH)/ocamlrun.a' \
972
-Wl,--whole-archive \
947
973
-Wl,--export-all-symbols \
948
-Wl,--no-whole-archive
974
-Wl,--allow-multiple-definition \
975
-Wl,--enable-auto-import
977
$(DLLSONAME): $(OBJ_LINK)
978
$(OCAMLMKLIB) $(INCFLAGS) $(CLIBFLAGS) \
979
-o $(CLIB_BASE) $(OBJ_LINK) $(CLIBS:%=-l%) \
980
$(CFRAMEWORKS:%=-framework %) \
951
985
$(DLLSONAME): $(OBJ_LINK)
952
986
link /NOLOGO /DLL /OUT:$@ $(OBJ_LINK) \
953
987
$(wildcard $(foreach dir,$(LIBDIRS),$(CLIBS:%=$(dir)/%.lib))) \
954
$(OCAMLLIBPATH)/ocamlrun.lib
988
'$(OCAMLLIBPATH)/ocamlrun.lib'
957
991
$(DLLSONAME): $(OBJ_LINK)