forked from mirage/ocaml-solo5
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
99 lines (82 loc) · 3.08 KB
/
Makefile
File metadata and controls
99 lines (82 loc) · 3.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
.PHONY: all clean install
FREESTANDING_LIBS=build/openlibm/libopenlibm.a \
build/ocaml/asmrun/libasmrun.a \
build/ocaml/otherlibs/libotherlibs.a \
build/nolibc/libnolibc.a
all: $(FREESTANDING_LIBS) ocaml-freestanding.pc
include Makeconf
Makeconf:
./configure.sh
TOP=$(abspath .)
FREESTANDING_CFLAGS+=-isystem $(TOP)/nolibc/include
build/openlibm/Makefile:
mkdir -p build/openlibm
cp -r openlibm build
build/openlibm/libopenlibm.a: build/openlibm/Makefile
$(MAKE) -C build/openlibm "CFLAGS=$(FREESTANDING_CFLAGS)" libopenlibm.a
build/ocaml/Makefile:
mkdir -p build
cp -r `ocamlfind query ocaml-src` build/ocaml
build/ocaml/config/Makefile: build/ocaml/Makefile
ifeq ($(OCAML_GTE_4_06_0),yes)
cp config/s.h build/ocaml/byterun/caml/s.h
cp config/m.$(BUILD_ARCH).h build/ocaml/byterun/caml/m.h
else
cp config/s.h build/ocaml/config/s.h
cp config/m.$(BUILD_ARCH).h build/ocaml/config/m.h
endif
cp config/Makefile.$(BUILD_OS).$(BUILD_ARCH) build/ocaml/config/Makefile
# Needed for OCaml >= 4.03.0, triggered by OCAML_EXTRA_DEPS via Makeconf
build/ocaml/byterun/caml/version.h: build/ocaml/config/Makefile
build/ocaml/tools/make-version-header.sh > $@
OCAML_CFLAGS=-O2 -fno-strict-aliasing -fwrapv -Wall -USYS_linux -DHAS_UNISTD $(FREESTANDING_CFLAGS)
OCAML_CFLAGS+=-I$(TOP)/build/openlibm/include -I$(TOP)/build/openlibm/src
build/ocaml/asmrun/libasmrun.a: build/ocaml/config/Makefile build/openlibm/Makefile $(OCAML_EXTRA_DEPS)
ifeq ($(OCAML_GTE_4_06_0),yes)
$(MAKE) -C build/ocaml/asmrun \
UNIX_OR_WIN32=unix \
CFLAGS="$(OCAML_CFLAGS)" \
libasmrun.a
else
$(MAKE) -C build/ocaml/asmrun \
UNIX_OR_WIN32=unix \
NATIVECCCOMPOPTS="$(OCAML_CFLAGS)" \
NATIVECCPROFOPTS="$(OCAML_CFLAGS)" \
libasmrun.a
endif
build/ocaml/otherlibs/libotherlibs.a: build/ocaml/config/Makefile
ifeq ($(OCAML_GTE_4_06_0),yes)
$(MAKE) -C build/ocaml/otherlibs/bigarray \
OUTPUTOBJ=-o \
CFLAGS="$(FREESTANDING_CFLAGS) -DIN_OCAML_BIGARRAY -I../../byterun" \
bigarray_stubs.o mmap_ba.o mmap.o
$(AR) rcs $@ \
build/ocaml/otherlibs/bigarray/bigarray_stubs.o \
build/ocaml/otherlibs/bigarray/mmap_ba.o \
build/ocaml/otherlibs/bigarray/mmap.o
else
$(MAKE) -C build/ocaml/otherlibs/bigarray \
CFLAGS="$(FREESTANDING_CFLAGS) -I../../byterun" \
bigarray_stubs.o mmap_unix.o
$(AR) rcs $@ \
build/ocaml/otherlibs/bigarray/bigarray_stubs.o \
build/ocaml/otherlibs/bigarray/mmap_unix.o
endif
build/nolibc/Makefile:
mkdir -p build
cp -r nolibc build
NOLIBC_CFLAGS=$(FREESTANDING_CFLAGS) -isystem $(TOP)/build/openlibm/src -isystem $(TOP)/build/openlibm/include
build/nolibc/libnolibc.a: build/nolibc/Makefile build/openlibm/Makefile
$(MAKE) -C build/nolibc \
"FREESTANDING_CFLAGS=$(NOLIBC_CFLAGS)" \
"SYSDEP_OBJS=$(NOLIBC_SYSDEP_OBJS)"
ocaml-freestanding.pc: ocaml-freestanding.pc.in Makeconf
sed -e 's!@@PKG_CONFIG_DEPS@@!$(PKG_CONFIG_DEPS)!' \
-e 's!@@PKG_CONFIG_EXTRA_LIBS@@!$(PKG_CONFIG_EXTRA_LIBS)!' \
ocaml-freestanding.pc.in > $@
install: all
./install.sh
uninstall:
./uninstall.sh
clean:
rm -rf build config Makeconf ocaml-freestanding.pc