-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
97 lines (73 loc) · 2.09 KB
/
Makefile
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
ifdef CROSS
OCAMLOPT=i686-w64-mingw32-ocamlopt
OCAMLC=i686-w64-mingw32-ocamlc
OCAMLDEP=i686-w64-mingw32-ocamldep
else
OCAMLOPT=ocamlopt
OCAMLC=ocamlc
OCAMLDEP=ocamldep
endif
INCL=
#OCAMLNLDFLAGS = -ccopt -static
OCAMLFLAGS=-unsafe -bin-annot -warn-error +a -w +a-42-45 -safe-string
VERSION=0.0.1
SRCMLI=fileExt.mli stringExt.mli listExt.mli hashtblExt.mli bytesExt.mli emit.mli
SRCMLI=version.mli
SRCMLI+=log.mli
SRCMLI+=archive.mli
SRCMLI+=aout.mli
SRCMLI+=problem.mli
SRCMLI+=linker.mli
SRCMLI+=alcyon.mli
SRCMLI+=coff.mli
SRCML=fileExt.ml stringExt.ml listExt.ml hashtblExt.ml bytesExt.ml emit.ml
SRCML+=version.ml
SRCML+=log.ml
SRCML+=archive.ml
SRCML+=aout.ml
SRCML+=problem.ml
SRCML+=linker.ml
SRCML+=alcyon.ml
SRCML+=coff.ml
SRCML+=main.ml
SRCS=$(SRCML) $(SRCMLI)
PROJECT=jlinker
EXTRA=README.md Makefile
LIBS=unix
BYTELIBS=$(LIBS:=.cma)
NATIVELIBS=$(LIBS:=.cmxa)
CMI=$(SRCMLI:.mli=.cmi)
CMO=$(SRCML:.ml=.cmo)
CMX=$(SRCML:.ml=.cmx)
all: .depend $(PROJECT).native $(PROJECT).byte
.PHONY: all clean dist
$(PROJECT).native: $(CMX)
$(OCAMLOPT) $(INCL) -o $@ $(NATIVELIBS) $^
$(PROJECT).byte: $(CMO)
$(OCAMLC) $(INCL) -o $@ $(BYTELIBS) $^
version.ml: Makefile
@echo "let date_of_compile=\""`date`"\"" > $@
@echo "let version=\""$(VERSION)"\"" >> $@
@echo "let build_info=\""`uname -msrn`"\"" >> $@
@echo "let revision=\""`git log -1 --format="%h"`"\"" >> $@
version.mli: Makefile
@echo "val date_of_compile: string" > $@
@echo "val version: string" >> $@
@echo "val build_info: string" >> $@
@echo "val revision: string" >> $@
dist: $(SRCS) $(EXTRA)
mkdir $(PROJECT)
cp $(SRCS) $(EXTRA) $(PROJECT)
tar cfvz $(PROJECT)-$(VERSION).tar.gz $(PROJECT)
rm -rf $(PROJECT)
%.cmo: %.ml
$(OCAMLC) $(INCL) -c $(OCAMLFLAGS) -o $@ $<
%.cmi: %.mli
$(OCAMLC) $(INCL) -c $(OCAMLFLAGS) -o $@ $<
%.cmx: %.ml
$(OCAMLOPT) $(INCL) -c $(OCAMLFLAGS) -o $@ $<
clean:
rm -f $(CMI) $(CMO) $(CMX) $(SRCML:.ml=.o) $(SRCML:.ml=.annot) $(SRCML:.ml=.cmi) $(SRCML:.ml=.cmt) $(SRCML:.ml=.cmti) version.ml version.mli $(PROJECT).byte $(PROJECT).native *~
.depend: $(SRCS)
$(OCAMLDEP) $(INCL) $(SRCS) > .depend
-include .depend