2 # Matt McCutchen's Big Integer Library
7 # Mention default target.
10 # Implicit rule to compile C++ files. Modify to your taste.
11 $(call mg-rule,%.o,%.cc,g++ -c -O -Wall -Wextra -pedantic $$< -o $$@)
13 # Components of the library.
14 library-objects = BigUnsigned.o BigInteger.o BigUnsignedInABase.o BigIntegerUtils.o
15 library-headers = NumberlikeArray.hh BigUnsigned.hh BigUnsignedInABase.hh BigInteger.hh BigIntegerLibrary.hh
17 # To ``make the library'', make all its objects using the implicit rule.
18 library : $(library-objects)
20 # Extra dependencies from `#include'.
21 $(call mg-prereq,BigUnsigned.o,NumberlikeArray.hh BigUnsigned.hh)
22 $(call mg-prereq,BigInteger.o,NumberlikeArray.hh BigUnsigned.hh BigInteger.hh)
23 $(call mg-prereq,BigUnsignedInABase.o,NumberlikeArray.hh BigUnsigned.hh BigUnsignedInABase.hh)
24 $(call mg-prereq,BigIntegerUtils.o,NumberlikeArray.hh BigUnsigned.hh BigUnsignedInABase.hh BigInteger.hh)
26 # The rules below build a program that uses the library. They are preset to
27 # build ``sample'' from ``sample.cc''. You can change the name(s) of the
28 # source file(s) and program file to build your own program, or you can write
31 # Components of the program.
33 program-objects = sample.o
35 # Conservatively assume all the program source files depend on all the library
36 # headers. You can change this if it is not the case.
37 $(call mg-prereq,$(program-objects),$(library-headers))
39 # How to link the program. The implicit rule covers individual objects.
40 $(call mg-rule,$(program),$(program-objects) $(library-objects),g++ $$(program-objects) $$(library-objects) -o $$@)
42 # Delete all generated files we know about.
44 rm -f $(library-objects) $(program-objects) $(program)
46 # I removed the *.tag dependency tracking system because it had few advantages
47 # over manually entering all the dependencies. If there were a portable,
48 # reliable dependency tracking system, I'd use it, but I know of no such;
49 # cons and depcomp are almost good enough.
51 # Come back and define default target.
52 all : library $(program)