| 1 | # |
| 2 | # Matt McCutchen's Big Integer Library |
| 3 | # |
| 4 | # Please see the project Web site at |
| 5 | # http://mysite.verizon.net/mccutchen/bigint/ |
| 6 | # for more information and the latest version. |
| 7 | # |
| 8 | # December 23, 2004 development version |
| 9 | # |
| 10 | # NEWS: |
| 11 | # We're now using array indexes instead of pointers. |
| 12 | # After having used pointers for faster speed, I decided |
| 13 | # that they detracted too much from the readability of |
| 14 | # the program and that a good optimizing compiler should |
| 15 | # be able to produce as efficient code. |
| 16 | |
| 17 | # The implicit rules we need |
| 18 | %.tag : % |
| 19 | touch $@ |
| 20 | %.o : %.cc |
| 21 | g++ -c -O -Wall -Wextra -pedantic $< |
| 22 | |
| 23 | # Default target |
| 24 | library : NumberlikeArray.hh.tag BigUnsigned.o BigInteger.o BigUnsignedInABase.o BigIntegerUtils.o |
| 25 | |
| 26 | # Extra `include' dependencies |
| 27 | BigUnsigned.hh.tag : NumberlikeArray.hh.tag |
| 28 | BigUnsigned.o : BigUnsigned.hh.tag |
| 29 | BigInteger.hh.tag : BigUnsigned.hh.tag |
| 30 | BigInteger.o : BigInteger.hh.tag |
| 31 | BigUnsignedInABase.hh.tag : BigUnsigned.hh.tag |
| 32 | BigUnsignedInABase.o : BigUnsignedInABase.hh.tag |
| 33 | BigIntegerUtils.hh.tag : BigInteger.hh.tag |
| 34 | BigIntegerUtils.o : BigIntegerUtils.hh.tag |
| 35 | |
| 36 | # sample program |
| 37 | sample : library sample.cc |
| 38 | g++ -osample *.o sample.cc |
| 39 | |
| 40 | clean : |
| 41 | rm -f *.tag *.o sample |
| 42 | |
| 43 | # The ``.tag'' mechanism allows for proper recompilation when a header file |
| 44 | # changes, considering that some header files may include others. |
| 45 | # |
| 46 | # If a header file X includes other header |
| 47 | # files Y and Z, we create a file X.tag that depends |
| 48 | # on X, Y.tag, and Z.tag. Other headers that include X should |
| 49 | # depend on X.tag. |
| 50 | # |
| 51 | # Suppose Y is subsequently changed. X doesn't get ``recompiled'', |
| 52 | # but anything that includes X should be recompiled. Well, Y.tag becomes |
| 53 | # out-of-date, so X.tag becomes out-of-date, so anything depending on X.tag |
| 54 | # (that is, anything including X) becomes out-of-date. Magic! |
| 55 | # |
| 56 | # In this system, the tag files are empty files used only for their |
| 57 | # timestamps. If one wished to use precompiled headers, one could use |
| 58 | # ``.gch'' files exactly how ``.tag'' files are used now, except that |
| 59 | # their contents would be meaningful. |
| 60 | # |
| 61 | # However, the same sort of ``deadly diamond'' problem that surfaces with |
| 62 | # multiple inheritance also applies to precompiled headers. The ``#ifndef'' |
| 63 | # mechanism that prevents multiple inclusion doesn't work when headers are |
| 64 | # compiled independently in a hierarchical structure, since the second |
| 65 | # inclusion of a file won't even know there was a first inclusion. For |
| 66 | # this reason, I just use ``.tag''s. |