]> rtime.felk.cvut.cz Git - l4.git/blob - l4/pkg/ocaml/ocaml/mk/mlbuild.mk
Update
[l4.git] / l4 / pkg / ocaml / ocaml / mk / mlbuild.mk
1 ifneq ($(SYSTEM),)
2
3 camloptfeature = $(if $(shell $(CAMLOPT) -h 2>&1 | grep -w -- $(1)),$(1))
4 COMPFLAGS      = -g $(if $(VERBOSE),,-verbose) -warn-error A \
5                  -nostdlib -output-obj \
6                  $(call camloptfeature,-nodynlink)
7
8 # the link is done because ocamlopt creates *.cmi and *.cmx in the source dir!
9 %.o: $(SRC_DIR)/%.ml #libasmrun.a
10         @echo -e "  ... Compiling Ocaml $@"
11         $(VERBOSE)$(RM) $(notdir $<)
12         $(VERBOSE)$(LN) -sf $(SRC_DIR)/$(notdir $<)
13         $(VERBOSE)$(CAMLOPT) $(COMPFLAGS) -I $(OCAML_INCDIR) -o $@.tmp.o $(notdir $<)
14         $(VERBOSE)$(LD) -m $(LD_EMULATION) -r -N -nostdlib -o $@ $@.tmp.o -L $(OCAML_LIBDIR) -locaml_asmrun
15
16 # some versions of ocamlopt (e.g. 3.10.2) want to have a libasmrun.a
17 # although we specify -nostdlib...
18 libasmrun.a: fake.o
19         ar r $@ $^
20
21 fake.c:
22         $(VERBOSE)echo > $@
23
24 endif