File: Makefile

package info (click to toggle)
findlib 1.2.5%2Bdebian-1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 1,496 kB
  • ctags: 678
  • sloc: ml: 4,661; xml: 2,445; sh: 1,322; makefile: 306
file content (130 lines) | stat: -rw-r--r-- 4,168 bytes parent folder | download
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
# make all: compile to bytecode
# make opt: compile to native code
# make install: install bytecode and/or native code
#----------------------------------------------------------------------

include Makefile.config

TOP=.

.PHONY: all opt install uninstall clean

all:
	for p in $(PARTS); do ( cd src/$$p; $(MAKE) all ); done
	$(MAKE) all-config

opt:
	for p in $(PARTS); do ( cd src/$$p; $(MAKE) opt ); done

install:
	mkdir -p "$(prefix)$(OCAMLFIND_BIN)"
	mkdir -p "$(prefix)$(OCAMLFIND_MAN)"
	for p in $(PARTS); do ( cd src/$$p; $(MAKE) install ); done
	$(MAKE) install-meta
	cd src/findlib; $(MAKE) install-num-top
	$(MAKE) install-config
	cp tools/safe_camlp4 "$(prefix)$(OCAMLFIND_BIN)"
	$(MAKE) install-doc

uninstall:
	$(MAKE) uninstall-doc
	$(MAKE) uninstall-meta
	for p in `cd src; echo *`; do ( cd src/$$p; $(MAKE) uninstall ); done
	$(MAKE) uninstall-config

clean:
	for p in `cd src; echo *`; do ( cd src/$$p; $(MAKE) clean ); done
	(cd itest-aux; $(MAKE) clean)
	(cd tools/extract_args; $(MAKE) clean)
	rm -f findlib.conf

.PHONY: release
release: README
	./release

README: doc/README
	ln -s doc/README .


.PHONY: all-config
all-config: findlib.conf

findlib.conf: findlib.conf.in 
	USE_CYGPATH="$(USE_CYGPATH)"; \
	export USE_CYGPATH; \
	cat findlib.conf.in | \
		tools/patch '@SITELIB@' '$(OCAML_SITELIB)' >findlib.conf
	if ocamlc.opt >/dev/null 2>&1; then \
		echo 'ocamlc="ocamlc.opt"' >>findlib.conf; \
	fi
	if ocamlopt.opt >/dev/null 2>&1; then \
		echo 'ocamlopt="ocamlopt.opt"' >>findlib.conf; \
	fi
	if ocamldep.opt >/dev/null 2>&1; then \
		echo 'ocamldep="ocamldep.opt"' >>findlib.conf; \
	fi

.PHONY: install-doc
install-doc:
	mkdir -p $(prefix)$(OCAMLFIND_MAN)/man1 $(prefix)$(OCAMLFIND_MAN)/man3 $(prefix)$(OCAMLFIND_MAN)/man5
	cp doc/ref-man/ocamlfind.1 $(prefix)$(OCAMLFIND_MAN)/man1
	cp doc/ref-man/META.5 doc/ref-man/site-lib.5 doc/ref-man/findlib.conf.5 $(prefix)$(OCAMLFIND_MAN)/man5

.PHONY: uninstall-doc
uninstall-doc:
	rm -f $(prefix)$(OCAMLFIND_MAN)/man1/ocamlfind.1
	rm -f $(prefix)$(OCAMLFIND_MAN)/man3/Findlib.3
	rm -f $(prefix)$(OCAMLFIND_MAN)/man3/Topfind.3
	rm -f $(prefix)$(OCAMLFIND_MAN)/man5/META.5
	rm -f $(prefix)$(OCAMLFIND_MAN)/man5/site-lib.5


.PHONY: install-meta
install-meta:
	for x in `ls site-lib-src`; do if [ "$$x" != "CVS" -a -f "site-lib-src/$$x/META" ]; then mkdir -p $(prefix)$(OCAML_SITELIB)/$$x; cp site-lib-src/$$x/META $(prefix)$(OCAML_SITELIB)/$$x; fi; done

.PHONY: uninstall-meta
uninstall-meta:
	for x in `ls site-lib-src`; do if [ "$$x" != "CVS" ]; then rm -rf $(prefix)$(OCAML_SITELIB)/$$x; fi; done

.PHONY: install-config
install-config:
	mkdir -p "`dirname \"$(prefix)$(OCAMLFIND_CONF)\"`"
	@if [ -f "$(prefix)$(OCAMLFIND_CONF)" ]; then echo "!!! Keeping old $(prefix)$(OCAMLFIND_CONF) !!!"; fi
	test -f "$(prefix)$(OCAMLFIND_CONF)" || cp findlib.conf "$(prefix)$(OCAMLFIND_CONF)"

.PHONY: uninstall-config
uninstall-config:
	@echo Leaving "$(OCAMLFIND_CONF)" installed, consider manual removal

.PHONY: interface-lists
interface-lists:
	d=`ocamlc -where`;                              \
	for x in `ls site-lib-src`; do                  \
	    iflist="";                                  \
            if [ ! -f "site-lib-src/$$x/interfaces.in" ]; then continue; fi; \
	    cma_spec=`cat site-lib-src/$$x/interfaces.in`;  \
	    for cma in $$d/$$cma_spec; do               \
		intf=`objinfo $$cma |                   \
		      grep 'Unit name:' |               \
		      sed -e 's/^  Unit name: //' |     \
		      sort |                            \
		      tr '\n' ' '`;                     \
		iflist="$$iflist $$intf";               \
	    done;                                       \
	    echo "$$iflist" >"site-lib-src/$$x/interfaces.out"; \
	done

######################################################################
# The following is from Pietro Abata <pietro.abate@anu.edu.au>
# to create MacOS X packages. I did not test it, just include it.

.PHONY: package-macosx

package-macosx: all opt
	mkdir -p package-macosx/root
	export prefix=`pwd`/package-macosx/root && make install 
	export VERSION=1.1.2 && tools/make-package-macosx

clean-macosx:
	sudo rm -rf package-macosx