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