summaryrefslogtreecommitdiff
path: root/manual/tests/Makefile
blob: 452f6321f5c9be51bc72097d94daaaf181c7cccb (plain)
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
ROOTDIR = ../..
include $(ROOTDIR)/api_docgen/Makefile.docfiles
include $(ROOTDIR)/Makefile.common
include $(ROOTDIR)/stdlib/StdlibModules
include $(ROOTDIR)/Makefile.best_binaries
OCAMLC ?= $(BEST_OCAMLC) $(STDLIBFLAGS)

MANUAL=$(ROOTDIR)/manual/src

.PHONY: all
all: check-cross-references check-stdlib check-case-collision

.PHONY: tools
tools: cross-reference-checker

cross-reference-checker: cross_reference_checker.ml
	$(OCAMLC) $(ROOTDIR)/compilerlibs/ocamlcommon.cma \
	  -I $(ROOTDIR)/parsing -I $(ROOTDIR)/driver \
	  $< -o $@

# check cross-references between the manual and error messages
.PHONY: check-cross-references
check-cross-references: cross-reference-checker
	$(OCAMLRUN) ./cross-reference-checker \
	  -auxfile $(MANUAL)/texstuff/manual.aux \
	  $(ROOTDIR)/utils/warnings.ml \
	  $(ROOTDIR)/driver/main_args.ml \
	  $(ROOTDIR)/lambda/translmod.ml

# check that all standard library modules are referenced by the
# standard library chapter of the manual
.PHONY: check-stdlib
check-stdlib:
	./check-stdlib-modules $(ROOTDIR)


# check name collision between latex source file and module documentation
# on case-insensitive file systems
normalize = $(shell echo $(basename $(notdir $(1) )) | tr A-Z a-z)
LOWER_MLIS= $(call normalize,$(ALL_DOC:%=%.mli))
LOWER_ETEX= $(call normalize,$(wildcard $(MANUAL)/*/*.etex) $(wildcard *.etex))
INTER = $(filter $(LOWER_ETEX), $(LOWER_MLIS))

.PHONY: check-case-collision
check-case-collision:
ifeq ($(INTER),)
	@echo "No collisions detected between OCaml modules and LaTeX sources."
else
	@echo "The following names"
	@echo "  $(INTER)"
	@echo "are used by both an OCaml module and a latex source file."
	@echo "This creates a conflict on case-insensitive file systems."
	@false
endif


.PHONY: clean
clean:
	rm -f *.cm? *.cmx? cross-reference-checker

.PHONY: distclean
distclean: clean