File: Makefile.simple

package info (click to toggle)
ocp-indent 1.4.2-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 1,304 kB
  • ctags: 1,256
  • sloc: ml: 7,010; sh: 315; makefile: 106; lisp: 77
file content (64 lines) | stat: -rw-r--r-- 1,363 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
# -*- makefile -*-

GENERATED = src/indentVersion.ml src/compat.ml

VERSION = $(shell awk -F'[(,)]' '/AC_INIT/ { print $$3 }' configure.ac)

OCAML_MAJOR = $(shell ocaml -vnum | sed 's/\..*//')
COMPAT_DIR = src/ocaml_$(OCAML_MAJOR)/

LIB = ocp-indent-lib

OCAML_HAVE_OCAMLOPT ?= yes

TARGETS := $(LIB).cma
ifeq ($(OCAML_HAVE_OCAMLOPT),yes)
	TARGETS += $(LIB).cmxa $(LIB).cmxs $(LIB).a
	SRCMETALASTLINE := 'archive(native) = "'$(LIB)'.cmxa"'
endif

.PHONY: all
all: $(TARGETS)

src/compat.ml: ALWAYS
	cp $(COMPAT_DIR)/compat.ml src/

src/indentVersion.ml:
	echo 'let version = "'$(VERSION)'"' > $@

ALWAYS:

%.cma: ALWAYS $(GENERATED)
	ocamlbuild src/$@

%.cmxa: ALWAYS $(GENERATED)
	ocamlbuild src/$@

%.cmxs: ALWAYS $(GENERATED)
	ocamlbuild src/$@

%.a: ALWAYS $(GENERATED)
	ocamlbuild src/$@

.PHONY: clean
clean:
	rm -rf $(GENERATED) META _build

_build/src/META:
	mkdir -p _build/src
	echo 'version = "'$(VERSION)'"' > $@
	echo 'archive(byte) = "'$(LIB)'.cma"' >> $@
	echo $(SRCMETALASTLINE) >> $@

INTERFACES = approx_lexer pos util indentConfig indentBlock indentPrinter nstream

IFEXP := $(INTERFACES:=.cmi) $(INTERFACES:=.mli)
ifeq ($(OCAML_HAVE_OCAMLOPT),yes)
	IFEXP += $(INTERFACES:=.cmx)
endif

.PHONY: install
install: _build/src/META $(TARGETS)
	ocamlfind remove ${LIB} || true
	cd _build/src && ocamlfind install $(LIB) META \
	  $(IFEXP) $(TARGETS)