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