quine.c: Fix double-close bug.
[quine] / Makefile.am
CommitLineData
267c6003 1## Process with `automake' to generate `Makefile.in'
2## -*-makefile-*-
3##
267c6003 4## Makefile for Quine
5##
6## (c) 1999 Mark Wooding
7##
8
9##----- Licensing notice ----------------------------------------------------
10##
11## This file is part of Quine.
12##
13## Quine is free software; you can redistribute it and/or modify it
14## under the terms of the GNU General Public License as published by
15## the Free Software Foundation; either version 2 of the License, or
16## (at your option) any later version.
17##
18## Quine is distributed in the hope that it will be useful, but
19## WITHOUT ANY WARRANTY; without even the implied warranty of
20## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21## GNU General Public License for more details.
22##
23## You should have received a copy of the GNU General Public License
24## along with Quine; if not, write to the Free Software Foundation,
25## Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26
267c6003 27AUTOMAKE_OPTIONS = foreign
28
29## --- What needs installing ---
30
31bin_PROGRAMS = quine
32noinst_PROGRAMS = ansicquine
33include_HEADERS = quine.h
34
35## --- How to build the program ---
36
37quine_SOURCES = quine.c qqout.c mdwopt.c quine.h mdwopt.h
38ansicquine_SOURCES = ansicquine.c
ab284d11 39EXTRA_DIST = \
40 qqlib.c qqout.c qqlout.c rexxquine.exec bournequine \
41 debian/control debian/changelog debian/rules debian/copyright
267c6003 42CLEANFILES = xquine yquine
43MAINTAINERCLEANFILES = qqout.c qqlout.c $(srcdir)/qqout.c $(srcdir)/qqlout.c
44
45## --- I need recursive makeness ---
46##
47## In this way, I can rebuild `xquine' and `yquine' only when they really
48## get needed.
49
50@SET_MAKE@
51
52## --- Some hacking for the bootstrapping process ---
53##
54## The outputtable library gets built from `qqlib.c'. I therefore have to
55## build a `quine' which can do this. This is `xquine'. Then, I can
56## build a `yquine' which is capable of writing full `qqout.c' files, with
57## which I can build the final glorious `quine'.
58
59xquine: xquine.o qqlib.o mdwopt.o
60 $(LINK) xquine.o qqlib.o mdwopt.o
61xquine.o: quine.c
62 $(COMPILE) -c -DQQ_XQUINE $(srcdir)/quine.c -o xquine.o
63
64yquine: yquine.o qqlib.o qqlout.o mdwopt.o
65 $(LINK) yquine.o qqlib.o qqlout.o mdwopt.o
66yquine.o: quine.c
67 $(COMPILE) -c -DQQ_YQUINE $(srcdir)/quine.c -o yquine.o
68
69## --- The `qqlout.c' file ---
70##
71## The contents of `qqlib.c' are included in every `qqout.c' file we write.
72## But I've got to get it from somewhere so that I can write it to the first
73## `qqout.c' file. The solution is, as described above, to use a cut-down
74## `quine' program which can just about build `qqlout.c' which contains only
75## the library.
76
77qqlout.c: qqlib.c
78 if [ -z "$(qq_xquine)" ]; then \
79 $(MAKE) qq_xquine=true xquine; \
80 else :; fi
81 ./xquine --qqlib $(srcdir)/qqlib.c -o qqlout.c
82
83## --- The `qqout.c' file ---
84##
85## This contains the complete source code for the program.
86
87qqout.c: quine.c qqlout.c qqlib.c mdwopt.c quine.h mdwopt.h
88 if [ -z "$(qq_yquine)" ]; then \
89 $(MAKE) qq_yquine=true yquine; \
90 else :; fi
91 touch qqout.c
92 -ln qqout.c qqlout.c $(srcdir)
93 $(MAKE) distdir
94 rm qqout.c
95 find $(distdir) \( -type f -o -type l \) ! -name qqout.c -print | \
96 ./yquine -o $(distdir)/qqout.c
97 ln $(distdir)/qqout.c qqout.c
98 rm -rf $(distdir)
99
100##----- That's all, folks ---------------------------------------------------