Mercurial > mxe-octave
annotate src/ocaml-core.mk @ 3319:2636b3458f4d
* src/msvc-octave-1.patch: Update to octave 3.7.7.
author | Michael Goffioul <michael.goffioul@gmail.com> |
---|---|
date | Tue, 12 Nov 2013 20:54:29 -0500 |
parents | 5ef49fb3299d |
children | 13be64f9f16d |
rev | line source |
---|---|
2836 | 1 # This file is part of mingw-cross-env. |
2 # See doc/index.html for further information. | |
3 | |
4 # zlib | |
5 PKG := ocaml-core | |
6 $(PKG)_IGNORE := | |
7 $(PKG)_CHECKSUM := $(ocaml-native_CHECKSUM) | |
8 $(PKG)_SUBDIR := $(ocaml-native_SUBDIR) | |
9 $(PKG)_FILE := $(ocaml-native_FILE) | |
10 $(PKG)_URL := $(ocaml-native_URL) | |
3048
5ef49fb3299d
treat gcc and binutils as build tools
John W. Eaton <jwe@octave.org>
parents:
3031
diff
changeset
|
11 $(PKG)_DEPS := bfd ocaml-flexdll ocaml-native |
2836 | 12 |
13 define $(PKG)_UPDATE | |
14 $(call ocaml-native_UPDATE) | |
15 endef | |
16 | |
17 | |
18 OTHER_LIBS := win32unix str num dynlink bigarray systhreads win32graph | |
19 | |
20 define $(PKG)_BUILD | |
21 # Build native ocamlrun and ocamlc which contain the | |
22 # filename-win32-dirsep patch. | |
23 # | |
24 # Note that we must build a 32 bit compiler, even on 64 bit build | |
25 # architectures, because this compiler will try to do strength | |
26 # reduction optimizations using its internal int type, and that must | |
27 # match Windows' int type. (That's what -cc and -host are for). | |
28 cd '$(1)' && ./configure \ | |
3012
100e618349f7
Improve handling of prefix directories by defining HOST_PREFIX and
John W. Eaton <jwe@octave.org>
parents:
3006
diff
changeset
|
29 -prefix '$(HOST_PREFIX)' \ |
3014
b6c7244a2f66
Use HOST_BINDIR, HOST_LIBDIR, and HOST_INCDIR instead of MXE_BINDIR, MXE_LIBDIR, and MXE_INCDIR. Attempt to use these variables consistently instead of using $(HOST_PREFIX)/bin, $(HOST_PREFIX)/lib, and $(HOST_PREFIX)/include
John W. Eaton <jwe@octave.org>
parents:
3012
diff
changeset
|
30 -bindir '$(HOST_BINDIR)' \ |
b6c7244a2f66
Use HOST_BINDIR, HOST_LIBDIR, and HOST_INCDIR instead of MXE_BINDIR, MXE_LIBDIR, and MXE_INCDIR. Attempt to use these variables consistently instead of using $(HOST_PREFIX)/bin, $(HOST_PREFIX)/lib, and $(HOST_PREFIX)/include
John W. Eaton <jwe@octave.org>
parents:
3012
diff
changeset
|
31 -libdir '$(HOST_LIBDIR)/ocaml' \ |
2836 | 32 -no-tk \ |
33 -cc "gcc -m32" \ | |
34 -no-shared-libs \ | |
35 -host '$(TARGET)' \ | |
36 -x11lib /usr/lib \ | |
37 -verbose | |
38 $(MAKE) -C '$(1)' core | |
39 # Now move the working ocamlrun, ocamlc into the boot/ directory, | |
40 # overwriting the binary versions which ship with the compiler with | |
41 # ones that contain the filename-win32-dirsep patch. | |
42 $(MAKE) -C '$(1)' coreboot | |
43 # second time, otherwise Segfault in some cases (depending on the runing system?) | |
44 $(MAKE) -C '$(1)' coreboot | |
45 $(MAKE) -C '$(1)' all | |
46 # install ocamldoc and camlp4 (non cross versions) | |
47 $(MAKE) -C '$(1)/ocamldoc' install | |
3014
b6c7244a2f66
Use HOST_BINDIR, HOST_LIBDIR, and HOST_INCDIR instead of MXE_BINDIR, MXE_LIBDIR, and MXE_INCDIR. Attempt to use these variables consistently instead of using $(HOST_PREFIX)/bin, $(HOST_PREFIX)/lib, and $(HOST_PREFIX)/include
John W. Eaton <jwe@octave.org>
parents:
3012
diff
changeset
|
48 cd '$(1)' && BINDIR=$(HOST_BINDIR) \ |
b6c7244a2f66
Use HOST_BINDIR, HOST_LIBDIR, and HOST_INCDIR instead of MXE_BINDIR, MXE_LIBDIR, and MXE_INCDIR. Attempt to use these variables consistently instead of using $(HOST_PREFIX)/bin, $(HOST_PREFIX)/lib, and $(HOST_PREFIX)/include
John W. Eaton <jwe@octave.org>
parents:
3012
diff
changeset
|
49 LIBDIR=$(HOST_LIBDIR)/ocaml \ |
3012
100e618349f7
Improve handling of prefix directories by defining HOST_PREFIX and
John W. Eaton <jwe@octave.org>
parents:
3006
diff
changeset
|
50 PREFIX=$(HOST_PREFIX) \ |
2836 | 51 ./build/partial-install.sh |
52 | |
53 ####### patch mingw include | |
54 # Now patch utils/clflags.ml to hardcode mingw-specific include. | |
3012
100e618349f7
Improve handling of prefix directories by defining HOST_PREFIX and
John W. Eaton <jwe@octave.org>
parents:
3006
diff
changeset
|
55 $(SED) -i "s,@libdir@,$(HOST_PREFIX)/lib,g" \ |
2836 | 56 $(1)/hardcode_mingw_include.patch |
57 cd '$(1)' && patch -p2 < hardcode_mingw_include.patch | |
58 | |
59 ####### prepare cross build | |
60 # Replace the compiler configuration (config/{s.h,m.h,Makefile}) | |
61 # with ones as they would be on a 32 bit Windows system. | |
62 cp -f '$(1)/config/m-nt.h' '$(1)/config/m.h' | |
63 cp -f $(1)/config/s-nt.h $(1)/config/s.h | |
64 # config/Makefile is a custom one which we supply. | |
65 rm -f $(1)/config/Makefile | |
66 $(SED) \ | |
3012
100e618349f7
Improve handling of prefix directories by defining HOST_PREFIX and
John W. Eaton <jwe@octave.org>
parents:
3006
diff
changeset
|
67 -e "s,@prefix@,$(HOST_PREFIX),g" \ |
2836 | 68 -e "s,@toolpref@,$(TARGET),g" \ |
69 -e "s,@otherlibraries@,$(OTHER_LIBS),g" \ | |
70 < $(1)/Makefile-mingw.in > $(1)/config/Makefile | |
3012
100e618349f7
Improve handling of prefix directories by defining HOST_PREFIX and
John W. Eaton <jwe@octave.org>
parents:
3006
diff
changeset
|
71 $(SED) -i "s,@libdir@,$(HOST_PREFIX)/lib,g" $(1)/otherlibs/Makefile.shared |
2836 | 72 # We're going to build in otherlibs/win32unix and otherlibs/win32graph |
73 # directories, but since they would normally only be built under | |
74 # Windows, they only have the Makefile.nt files. Just symlink | |
75 # Makefile -> Makefile.nt for these cases. | |
3012
100e618349f7
Improve handling of prefix directories by defining HOST_PREFIX and
John W. Eaton <jwe@octave.org>
parents:
3006
diff
changeset
|
76 $(SED) -i "s,@libdir@,$(HOST_PREFIX)/lib,g" $(1)/otherlibs/win32unix/Makefile.nt |
100e618349f7
Improve handling of prefix directories by defining HOST_PREFIX and
John W. Eaton <jwe@octave.org>
parents:
3006
diff
changeset
|
77 $(SED) -i "s,@libdir@,$(HOST_PREFIX)/lib,g" $(1)/otherlibs/win32graph/Makefile.nt |
100e618349f7
Improve handling of prefix directories by defining HOST_PREFIX and
John W. Eaton <jwe@octave.org>
parents:
3006
diff
changeset
|
78 $(SED) -i "s,@libdir@,$(HOST_PREFIX)/lib,g" $(1)/otherlibs/systhreads/Makefile.nt |
2836 | 79 for d in $(1)/otherlibs/win32unix \ |
80 $(1)/otherlibs/win32graph \ | |
81 $(1)/otherlibs/bigarray \ | |
82 $(1)/otherlibs/systhreads; do \ | |
3006
dabfd7db980c
use cp for ln on mingw native builds
John W. Eaton <jwe@octave.org>
parents:
2836
diff
changeset
|
83 $(LN_SF) Makefile.nt $$d/Makefile; \ |
2836 | 84 done |
85 # Now clean the temporary files from the previous build. This | |
86 # will also cause asmcomp/arch.ml (etc) to be linked to the 32 bit | |
87 # i386 versions, essentially causing ocamlopt to use the Win/i386 code | |
88 # generator. | |
89 $(MAKE) -C '$(1)' partialclean | |
90 # We need to remove any .o object for make sure they are | |
91 # recompiled later.. | |
92 cd $(1) && rm byterun/*.o | |
93 | |
94 ####### build mingw ocaml | |
95 # Just rebuild some small bits that we need for the following | |
96 # 'make opt' to work. Note that 'make all' fails here. | |
97 $(MAKE) -C '$(1)/byterun' libcamlrun.a | |
98 $(MAKE) -C '$(1)' ocaml ocamlc | |
99 $(MAKE) -C '$(1)/stdlib' | |
100 $(MAKE) -C '$(1)/tools' ocamlmklib | |
101 # Build ocamlopt | |
102 $(MAKE) -C '$(1)' opt | |
103 # Now build otherlibs for ocamlopt | |
104 cd '$(1)' && \ | |
105 for i in $(OTHER_LIBS); do \ | |
106 $(MAKE) -C otherlibs/$$i clean; \ | |
107 $(MAKE) -C otherlibs/$$i all; \ | |
108 $(MAKE) -C otherlibs/$$i allopt; \ | |
109 done | |
110 | |
111 ####### installation | |
112 $(MAKE) -C '$(1)' install | |
113 $(MAKE) -C '$(1)' installopt | |
114 # Rename all the binaries to target-binary | |
115 for f in ocamlc ocamlcp ocamlrun ocamldep ocamlmklib ocamlmktop ocamlopt ocamlprof camlp4prof camlp4boot camlp4 camlp4oof camlp4of camlp4o camlp4rf camlp4r camlp4orf ocamldoc ; do \ | |
3031
951da75fd09c
improve handling of cross tool prefix
John W. Eaton <jwe@octave.org>
parents:
3014
diff
changeset
|
116 cp -f $(HOST_BINDIR)/$$f $(BUILD_TOOLS_PREFIX)/bin/$(MXE_TOOL_PREFIX)$$f; \ |
2836 | 117 done |
118 | |
119 # test ocamlopt | |
120 cp '$(2).ml' '$(1)/test.ml' | |
3031
951da75fd09c
improve handling of cross tool prefix
John W. Eaton <jwe@octave.org>
parents:
3014
diff
changeset
|
121 cd '$(1)' && '$(MXE_TOOL_PREFIX)ocamlopt' test.ml |
2836 | 122 # test ocamlbuild |
123 mkdir '$(1)/tmp' && cp '$(2).ml' '$(1)/tmp/test.ml' | |
3031
951da75fd09c
improve handling of cross tool prefix
John W. Eaton <jwe@octave.org>
parents:
3014
diff
changeset
|
124 cd '$(1)/tmp' && $(MXE_TOOL_PREFIX)ocamlbuild test.native |
2836 | 125 # test |
126 cp '$(2).ml' '$(1)/test.ml' | |
3031
951da75fd09c
improve handling of cross tool prefix
John W. Eaton <jwe@octave.org>
parents:
3014
diff
changeset
|
127 cd '$(1)' && '$(MXE_TOOL_PREFIX)ocamlopt' test.ml |
2836 | 128 endef |