aboutsummaryrefslogtreecommitdiff
path: root/config/setup-dep.mk
blob: 7e7731feb0f7b71ae2602e3bfa65cc7948e62c5f (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
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
## ---------------------------------------
## -- Standard boilerplate dependencies --
## ---------------------------------------

# Recursive rules, usually automatically generated by Automake.
# Since we do not use (yet) Automake, we mimic the behaviour as
# close as possible.
# Recursive wall of sub-directories is based on the variable
# SUBDIRS.  That variable usually contains the of sub-directories
# to be made in depth-first postfix.  However, that order can
# be changed to depth-first prefix by explicitly including "."
# in SUBDIRS.  Rules ending with '-ax' are those specific to the
# the current directory.  Notice that the '-ax' rules are similar 
# to Automake generated '-am'.
.PHONY: $(RECURSIVE_TARGETS)
$(RECURSIVE_TARGETS):
	failcmd='exit 1'; \
	for f in $$MAKEFLAGS; do \
	   case $$f in \
	      *=* | --[!k]*) ;; \
	      *k*) failcmd='fail=yes';; \
	   esac; \
	done; \
	dot_seen=no; \
	target=`echo $@ | sed s/-recursive//`; list='$(SUBDIRS)'; \
	for subdir in $$list; do \
	   echo "Making $$target in $$subdir"; \
	   if test "$$subdir" = "."; then \
	      dot_seen=yes; \
	      local_target="$$target-ax"; \
	   else \
	      local_target="$$target"; \
	   fi; \
	   (cd $$subdir && $(MAKE) $$local_target) || eval $$failcmd; \
	done; \
	if test "$$dot_seen" = "no"; then \
	   $(MAKE) "$$target-ax" || exit 1; \
	fi; test -z "$$fail"

# Recursive cleanup is done in reverse, postfix order of ordinary build.
.PHONY: mostlyclean-recursive
.PHONY: clean-recursive
.PHONY: distclean-recursive
.PHONY: maintainer-clean-recursive
mostlyclean-recursive clean-recursive distclean-recursive \
maintainer-clean-recursive:
	@failcmd='exit 1'; \
	for f in $$MAKEFLAGS; do \
	   case $$f in \
	      *=* | --[!k]*) ;; \
	      *k*) failcmd='fail=yes';; \
	   esac; \
	done; \
	dot_seen=no; \
	case "$@" in \
	   distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
	   *) list='$(SUBDIRS)' ;; \
	esac; \
	rev=''; \
	for subdir in $$list; do \
	   if test "$$subdir" != "."; then \
	      rev="$$subdir $$rev"; \
	   fi; \
	done; \
	rev="$$rev ."; \
	target=`echo $@ | sed s/-recursive//`; \
	for subdir in $$rev; do \
	   echo "Making $$target in $$subdir"; \
	   if test "$$subdir" = "."; then \
	      local_target="$$target-ax"; \
	   else \
	      local_target="$$target"; \
	   fi; \
	   (cd $$subdir && $(MAKE) $$local_target) || eval $$failcmd; \
	done && test -z "$$fail"

## Rules to make DVI files from pamphlets

.PRECIOUS: %.tex
.PRECIOUS: %.dvi

DVI_FILES = $(addprefix $(oa_target_docdir)/$(subdir), \
		$(pamphlets:.pamphlet=.dvi))

pamphlets_SOURCES = $(addprefix $(srcdir)/, $(pamphlets))

.PHONY: dvi dvi-ax
dvi: dvi-recursive
dvi-ax: $(oa_build_texdir)/axiom.sty $(DVI_FILES)

$(oa_target_docdir)/$(subdir)%.dvi: $(builddir)/%.dvi
	$(mkinstalldirs) $(oa_target_docdir)/$(subdir)
	$(INSTALL_DATA) $< $@

%.dvi: %.tex $(oa_build_texdir)/axiom.sty
	TEXINPUTS=".:$(oa_build_texdir):$${TEXINPUTS}"; \
	export TEXINPUTS; \
	BIBINPUTS=".:$(oa_build_texdir):$${TEXINPUTS}"; \
	export BIBINPUTS; \
	$(oa_hammer) --latex $<

%.tex: $(srcdir)/%.pamphlet
	$(oa_hammer) --weave --output=$@ $<


.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_srcdir)/config/var-def.mk \
	  $(top_srcdir)/config/setup-dep.mk \
	  $(abs_top_builddir)/config.status
	cd $(abs_top_builddir) && $(SHELL) ./config.status $(subdir)$@

$(top_builddir)/src/lisp/core.lisp: \
	$(top_srcdir)/src/lisp/core.lisp.in \
	$(top_builddir)/config.status
	cd $(top_builddir) && \
	$(SHELL) ./config.status src/lisp/core.lisp

## Cleanup.
##   Each Makefile is responsible of defining targets named
##   mostlyclean-local, clean-local, and distclean-local.
.PHONY: mostlyclean-generic mostlyclean-local mostlyclean mostlyclean-ax
mostlyclean-generic:
	@-rm -f *~
	@-rm -f *.log *.aux *.toc

mostlyclean: mostlyclean-recursive
mostlyclean-ax: mostlyclean-generic mostlyclean-local

.PHONY: clean-generic clean-local clean clean-ax
clean-generic: mostlyclean-generic
	@-rm -f *.tex *.dvi

clean: clean-recursive
clean-ax: clean-generic clean-local

.PHONY: distclean-generic distclean-local distclean distclean-ax
distclean-generic: clean-generic
	@-rm -rf $(oa_target_docdir)/$(subdir)

distclean: distclean-recursive
distclean-ax: distclean-generic distclean-local