- Move the BigUnsigned conversion templates to fix a build error.
[bigint/bigint.git] / Makefile
... / ...
CommitLineData
1# Mention default target.
2all:
3
4# Implicit rule to compile C++ files. Modify to your taste.
5%.o: %.cc
6 g++ -c -O2 -Wall -Wextra -pedantic $<
7
8# Components of the library.
9library-objects = \
10 BigUnsigned.o \
11 BigInteger.o \
12 BigIntegerAlgorithms.o \
13 BigUnsignedInABase.o \
14 BigIntegerUtils.o \
15
16library-headers = \
17 NumberlikeArray.hh \
18 BigUnsigned.hh \
19 BigInteger.hh \
20 BigIntegerAlgorithms.hh \
21 BigUnsignedInABase.hh \
22 BigIntegerLibrary.hh \
23
24# To ``make the library'', make all its objects using the implicit rule.
25library: $(library-objects)
26
27# Conservatively assume that all the objects depend on all the headers.
28$(library-objects): $(library-headers)
29
30# TESTSUITE
31# Compiling the testsuite.
32testsuite.o: $(library-headers)
33testsuite: testsuite.o $(library-objects)
34 g++ $^ -o $@
35# Extract the expected output from the testsuite source.
36testsuite.expected: testsuite.cc
37 sed -nre 's,^.*//([^ ]),\1,p' $< >$@
38# Run the testsuite.
39.PHONY: test
40test: testsuite testsuite.expected
41 ./run-testsuite
42
43# The rules below build a program that uses the library. They are preset to
44# build ``sample'' from ``sample.cc''. You can change the name(s) of the
45# source file(s) and program file to build your own program, or you can write
46# your own Makefile.
47
48# Components of the program.
49program = sample
50program-objects = sample.o
51
52# Conservatively assume all the program source files depend on all the library
53# headers. You can change this if it is not the case.
54$(program-objects) : $(library-headers)
55
56# How to link the program. The implicit rule covers individual objects.
57$(program) : $(program-objects) $(library-objects)
58 g++ $^ -o $@
59
60# Delete all generated files we know about.
61clean :
62 rm -f $(library-objects) $(program-objects) $(program)
63
64# I removed the *.tag dependency tracking system because it had few advantages
65# over manually entering all the dependencies. If there were a portable,
66# reliable dependency tracking system, I'd use it, but I know of no such;
67# cons and depcomp are almost good enough.
68
69# Come back and define default target.
70all : library $(program)