Old snapshot `bigint-2006.02.26'; see the ChangeLog file.
[bigint/bigint.git] / Makefile
CommitLineData
e67d6049
MM
1#
2# Matt McCutchen's Big Integer Library
b1f5f69e 3# http://hashproduct.metaesthetics.net/bigint/
e67d6049 4#
e67d6049 5
05780f4b
MM
6# The implicit rules we need
7%.tag : %
8 touch $@
9%.o : %.cc
10 g++ -c -O -Wall -Wextra -pedantic $<
e67d6049 11
05780f4b 12# Default target
a8b42b68 13all : library sample
e67d6049 14
a8b42b68
MM
15library : BigUnsigned.o BigInteger.o BigUnsignedInABase.o BigIntegerUtils.o
16
17# Extra dependencies from `#include'
05780f4b
MM
18BigUnsigned.hh.tag : NumberlikeArray.hh.tag
19BigUnsigned.o : BigUnsigned.hh.tag
20BigInteger.hh.tag : BigUnsigned.hh.tag
21BigInteger.o : BigInteger.hh.tag
22BigUnsignedInABase.hh.tag : BigUnsigned.hh.tag
23BigUnsignedInABase.o : BigUnsignedInABase.hh.tag
24BigIntegerUtils.hh.tag : BigInteger.hh.tag
25BigIntegerUtils.o : BigIntegerUtils.hh.tag
e67d6049 26
05780f4b
MM
27# sample program
28sample : library sample.cc
29 g++ -osample *.o sample.cc
e67d6049 30
05780f4b
MM
31clean :
32 rm -f *.tag *.o sample
e67d6049 33
a8b42b68 34# The `.tag' mechanism allows for proper recompilation when a header file
05780f4b
MM
35# changes, considering that some header files may include others.
36#
37# If a header file X includes other header
38# files Y and Z, we create a file X.tag that depends
39# on X, Y.tag, and Z.tag. Other headers that include X should
40# depend on X.tag.
41#
42# Suppose Y is subsequently changed. X doesn't get ``recompiled'',
43# but anything that includes X should be recompiled. Well, Y.tag becomes
44# out-of-date, so X.tag becomes out-of-date, so anything depending on X.tag
45# (that is, anything including X) becomes out-of-date. Magic!
46#
47# In this system, the tag files are empty files used only for their
48# timestamps. If one wished to use precompiled headers, one could use
49# ``.gch'' files exactly how ``.tag'' files are used now, except that
50# their contents would be meaningful.
51#
52# However, the same sort of ``deadly diamond'' problem that surfaces with
53# multiple inheritance also applies to precompiled headers. The ``#ifndef''
54# mechanism that prevents multiple inclusion doesn't work when headers are
55# compiled independently in a hierarchical structure, since the second
56# inclusion of a file won't even know there was a first inclusion. For
57# this reason, I just use ``.tag''s.