forked from danmey/typerex
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
155 lines (134 loc) · 4.64 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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
-include Makefile.config
all: compile
# Workaround ocp-build bug #92
FIX=typerex-config ocplib-lang ocplib-system ocaml-config
compile: ./_obuild/unixrun ocp-typerex.ocp
$(OCPBUILD) -init -scan -sanitize $(FIX) $(TOOLS)
make -C tools/ocp-typerex-ide
ocp-typerex.ocp: ocp-typerex.ocp.template Makefile.config
echo "(* Generated from $< *)" >$@
cat $< | \
sed -e 's/OCP_BUILD_OCAMLC/$(subst /,\/,$(OCP_BUILD_OCAMLC))/g' | \
sed -e 's/OCP_BUILD_OCAMLOPT/$(subst /,\/,$(OCP_BUILD_OCAMLOPT))/g' | \
sed -e 's/OCP_BUILD_OCAMLDEP/$(subst /,\/,$(OCP_BUILD_OCAMLDEP))/g' | \
sed -e 's/OCP_BUILD_OCAMLLEX/$(subst /,\/,$(OCP_BUILD_OCAMLLEX))/g' | \
sed -e 's/OCP_BUILD_OCAMLYACC/$(subst /,\/,$(OCP_BUILD_OCAMLYACC))/g' | \
sed -e 's/OCP_BUILD_CCOPT/$(subst /,\/,$(OCP_BUILD_CCOPT))/g' | \
cat >>$@
./_obuild/unixrun:
mkdir -p ./_obuild
ocamlc -o ./_obuild/unixrun -make-runtime unix.cma
scan: ./_obuild/unixrun
$(OCPBUILD) -scan
sanitize: ./_obuild/unixrun
$(OCPBUILD) -sanitize
byte: ./_obuild/unixrun
$(OCPBUILD) -byte
opt: ./_obuild/unixrun
$(OCPBUILD) -asm
ocp-build:
$(OCPBUILD) ocp-build
tests: all
$(UNIT_TESTS)
# ocp-build
TOOLS=\
ocp-type \
ocp-wrapper \
ocp-wizard
install: install-binaries install-emacs
@echo "Remember to configure Emacs for TypeRex. You may do it by running:"
@echo " cat emacs.append >>~/.emacs"
install-binaries:
mkdir -p $(BINDIR)
@for f in $(TOOLS); do \
echo "install _obuild/$$f/$$f.asm $(BINDIR)/$$f"; \
install _obuild/$$f/$$f.asm $(BINDIR)/$$f; \
done
@for compiler in ocamlc ocamlopt ocamlc.opt ocamlopt.opt; do \
echo "install _obuild/ocp-wrapper/ocp-wrapper.asm" \
"$(BINDIR)/ocp-$$compiler"; \
install _obuild/ocp-wrapper/ocp-wrapper.asm \
$(BINDIR)/ocp-$$compiler; \
done
uninstall:
rm -f $(EMACSDIR)/typerex.el $(EMACSDIR)/typerex.elc
@for f in $(TOOLS); do \
echo "rm -f $(BINDIR)/$$f"; \
rm -f $(BINDIR)/$$f; \
done
@for compiler in ocamlc ocamlopt ocamlc.opt ocamlopt.opt; do \
echo "rm $(BINDIR)/ocp-wrapper-$$compiler"; \
rm $(BINDIR)/ocp-$$compiler; \
done
@echo "Remember to remove the TypeRex section in your .emacs"
ifdef INSTALL_AUTO_COMPLETE
@echo "Emacs Auto Complete Mode was not deleted. To remove it, run:"
@echo " cd $(EMACSDIR)"
@echo " rm -r auto-complete* popup.* fuzzy.* ac-dict"
endif
clean: clean-temps
-$(OCPBUILD) -clean
rm -f tools/ocp-wizard/completion/syntactic/owz_parser.mli
make -C tools/ocp-typerex-ide clean
make -C emacs-plugins clean
clean-temps:
find . -name '*~' -exec rm -f {} \;
find . -name '#*#' -exec rm -f {} \;
find . -name '*.annot' -exec rm -f {} \;
find . -name '*.cmt' -exec rm -f {} \;
find . -name '*.cmti' -exec rm -f {} \;
find . -name '*.last_compiled' -and \
-not -path "./tools/ocp-wizard/test/errors.ml.last_compiled" \
-exec rm -f {} \;
find docs -name '*.aux' -exec rm -f {} \;
find docs -name '*.log' -exec rm -f {} \;
find docs -name '*.toc' -exec rm -f {} \;
distclean: clean
-$(OCPBUILD) -distclean
rm -rf _obuild ocp-build.root ocp-build.root.old
Makefile.config ocp-typerex.ocp emacs.append
# update boot/ with and check it works
bootstrap: byte
mv boot Saved
mkdir boot
mv Saved boot/Saved
_obuild/ocp-bytehack/ocp-bytehack.byte -static _obuild/ocp-build/ocp-build.byte -o boot/ocp-build.boot
$(MAKE) clean
$(MAKE) byte
# restore saved version of boot/
restore:
mv boot/Saved Current
mv boot boot-to-remove
mv Current boot
rm -rf boot-to-remove
# clean all old versions of boot/./
bootclean:
rm -rf boot/Saved
runner-from-unix:
ocamlc -custom -make-runtime -o boot/ocp-build-runner -linkall unix.a unix.cma
make-boot:
ocamlc -o boot/ocp-build.boot -use-runtime boot/ocp-build-runner \
-use-prims boot/prims_needed.txt \
unix.cma \
./_obuild/ocplib-lang/ocplib-lang.cma \
./_obuild/ocplib-system/ocplib-system.cma \
./_obuild/ocp-build-engine/ocp-build-engine.cma \
./_obuild/ocp-build-lib/ocp-build-lib.cma \
./_obuild/ocp-build/buildMain.cmo
user-manual:
find libs -name 'user-manual.tex' -exec cat {} \; > docs/user-manual/auto-libs.tex
find tools -name 'user-manual.tex' -exec cat {} \; > docs/user-manual/auto-tools.tex
cd docs/user-manual; $(MAKE)
# Emacs
install-emacs:
mkdir -p $(EMACSDIR)
install tools/ocp-typerex-ide/emacs/typerex.el $(EMACSDIR)/typerex.el
@if [ -z "$(NOCOMPILE)" ]; then \
echo \
"install tools/ocp-ide/emacs/typerex.elc $(EMACSDIR)/typerex.elc"; \
install tools/ocp-typerex-ide/emacs/typerex.elc $(EMACSDIR)/typerex.elc; \
fi
ifdef INSTALL_AUTO_COMPLETE
@mkdir -p $(EMACSDIR)/auto-complete-mode
@echo `make -s -C emacs-plugins install DIR=$(EMACSDIR)/auto-complete-mode &>/dev/null` > /dev/null
endif