File: Makefile

package info (click to toggle)
ocamlnet 4.1.2-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 51,764 kB
  • ctags: 16,446
  • sloc: ml: 148,419; ansic: 10,989; sh: 1,885; makefile: 1,355
file content (111 lines) | stat: -rw-r--r-- 2,854 bytes parent folder | download | duplicates (2)
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
# make all: compiles the configured packages with ocamlc
# make opt: compiles the configured packages with ocamlopt
# make install: installs the configured packages
# make clean: cleans everything up

# Inclusion of Makefile.conf may fail when cleaning up:
-include Makefile.conf

NAME=ocamlnet
TOP_DIR=.

# PKGLIST: should be set in Makefile.conf. It contains the packages to
# compile and to install. The following assignment sets it to its 
# default value if no Makefile.conf exists.
PKGLIST ?= netstring cgi

.PHONY: build
build: all
	if ocamlopt 2>/dev/null; then $(MAKE) opt; fi

.PHONY: all
all: tools
	for pkg in $(PKGLIST); do \
		( cd src/$$pkg && $(MAKE) -f Makefile.pre generate ) || exit; \
		( cd src/$$pkg && $(MAKE) -f Makefile.pre depend ) || exit; \
		( cd src/$$pkg && $(MAKE) all ) || exit; \
	done

.PHONY: opt
opt: tools
	for pkg in $(PKGLIST); do \
		( cd src/$$pkg && $(MAKE) -f Makefile.pre generate ) || exit; \
		( cd src/$$pkg && $(MAKE) -f Makefile.pre depend ) || exit; \
		( cd src/$$pkg && $(MAKE) opt ) || exit; \
	done


.PHONY: doc
doc:
	for pkg in src/*/.; do \
	    test ! -f $$pkg/Makefile -o -f $$pkg/doc-ignore || \
		{ ( cd $$pkg && $(MAKE) -f Makefile.pre generate ) || exit; \
		  ( cd $$pkg && $(MAKE) -f Makefile.pre depend ) || exit; \
		  ( cd $$pkg && $(MAKE) doc-dump ) || exit; \
		}; \
	done
	cd doc; $(MAKE) doc

.PHONY: tools
tools:
	( cd tools/cppo-$(CPPO_VERSION) && $(MAKE) all )
	( cd tools/unimap_to_ocaml && $(MAKE) all )


# The following PHONY rule is important for Cygwin:
.PHONY: install
install:
	mkdir -p $(DESTDIR) $(OCAMLFIND_DESTDIR) $(OCAMLFIND_DESTDIR)/stublibs
	for pkg in $(PKGLIST); do \
		( cd src/$$pkg && $(MAKE) -f Makefile.pre install ) || exit; \
	done

.PHONY: uninstall
uninstall:
	for pkg in src/*/.; do \
		test ! -f $$pkg/Makefile || \
			( cd $$pkg && $(MAKE) -f Makefile.pre uninstall); \
	done

.PHONY: clean
clean:
	for pkg in src/*/.; do \
		test ! -f $$pkg/Makefile || \
			( cd $$pkg && $(MAKE) -f Makefile.pre clean); \
	done
	if test -f doc/Makefile; then cd doc && $(MAKE) clean; fi
	( cd tools/cppo-$(CPPO_VERSION) && $(MAKE) clean )
	( cd tools/unimap_to_ocaml && $(MAKE) clean )

.PHONY: clean-doc
clean-doc:
	for pkg in src/*/.; do \
		test ! -f $$pkg/Makefile -o -f $$pkg/doc-ignore || \
			( cd $$pkg && $(MAKE) -f Makefile.pre clean-doc); \
	done
	cd doc && $(MAKE) clean-doc

.PHONY: CLEAN
CLEAN: clean

.PHONY: distclean
distclean:
	rm -rf tmp
	for pkg in src/*/.; do \
		test ! -f $$pkg/Makefile || \
			( cd $$pkg && $(MAKE) -f Makefile.pre distclean); \
	done
	rm -f Makefile.conf config.cppo setup.save

# That one is for oasis

.PHONY: postconf
postconf:
	cat setup.save >>setup.data


# phony because VERSION may also change
.PHONY: _oasis
_oasis: _oasis.in
	v=`./configure -version`; sed -e 's/@VERSION@/'"$$v/" _oasis.in >_oasis
	oasis setup