[97ff24] | 1 | # |
---|
| 2 | # GNUmakefile - `GNUmakefile' to make some sample applications of |
---|
| 3 | # Factory. |
---|
| 4 | # |
---|
| 5 | # Note: This `GNUmakefile' is not configured by `configure'. To |
---|
| 6 | # configure it, change the variables at the beginning of the |
---|
| 7 | # file. |
---|
| 8 | # |
---|
[0a6813] | 9 | # For more information on the files in the `examples/' directory, |
---|
| 10 | # see the section "Examples and Tests" in the `README' file. |
---|
| 11 | # |
---|
[97ff24] | 12 | |
---|
| 13 | # |
---|
| 14 | # - paths. |
---|
| 15 | # |
---|
| 16 | |
---|
| 17 | # where to look for GMP and Factory |
---|
| 18 | GMPPREFIX=/usr/local |
---|
| 19 | FACTORYPREFIX=$(HOME)/factory |
---|
| 20 | |
---|
| 21 | # |
---|
| 22 | # - flags. |
---|
| 23 | # |
---|
| 24 | |
---|
| 25 | # compiler |
---|
| 26 | CXX=g++ |
---|
| 27 | |
---|
| 28 | # compiler and linker options. Configured for an optimized |
---|
| 29 | # version of Factory. |
---|
| 30 | WARNFLAGS=-w |
---|
| 31 | DEFS= |
---|
| 32 | CPPFLAGS= |
---|
| 33 | CFLAGS=-O2 -fomit-frame-pointer |
---|
| 34 | CXXFLAGS=-O2 -fomit-frame-pointer |
---|
| 35 | LIBS=-L$(FACTORYPREFIX)/lib -lcf -lcfmem -L$(GMPPREFIX)/lib -lgmp -lm |
---|
| 36 | LDFLAGS= |
---|
| 37 | |
---|
| 38 | # |
---|
| 39 | # - compiler flags. |
---|
| 40 | # |
---|
| 41 | |
---|
| 42 | # flags to translate ftmpl_inst.cc. We allow implicit template |
---|
| 43 | # instantiations in this case. |
---|
| 44 | TMPLCXXFLAGS = $(WARNFLAGS) \ |
---|
| 45 | -I$(FACTORYPREFIX)/include \ |
---|
| 46 | $(DEFS) $(CPPFLAGS) $(CXXFLAGS) |
---|
| 47 | |
---|
| 48 | # flags to translate application |
---|
| 49 | APPLCXXFLAGS = $(WARNFLAGS) -fno-implicit-templates \ |
---|
| 50 | -I$(FACTORYPREFIX)/include \ |
---|
| 51 | $(DEFS) $(CPPFLAGS) $(CXXFLAGS) |
---|
| 52 | |
---|
| 53 | # flags to link application |
---|
| 54 | APPLLDFLAGS = $(LIBS) $(LDFLAGS) |
---|
| 55 | |
---|
| 56 | # |
---|
| 57 | # - files. |
---|
| 58 | # |
---|
| 59 | applications := \ |
---|
[d21a61] | 60 | application \ |
---|
| 61 | factorize \ |
---|
| 62 | gcd |
---|
[97ff24] | 63 | |
---|
| 64 | # |
---|
| 65 | # - phony targets. |
---|
| 66 | # |
---|
| 67 | .PHONY: all clean |
---|
| 68 | |
---|
| 69 | # |
---|
| 70 | # - pattern rules. |
---|
| 71 | # |
---|
| 72 | %.o: %.cc |
---|
| 73 | $(CXX) -c $< $(APPLCXXFLAGS) -o $@ |
---|
| 74 | |
---|
| 75 | # |
---|
| 76 | # - explicit targets. |
---|
| 77 | # |
---|
| 78 | |
---|
| 79 | # compile all applications |
---|
| 80 | all: $(applications) |
---|
| 81 | |
---|
| 82 | ftmpl_inst.o: $(FACTORYPREFIX)/include/templates/ftmpl_inst.cc |
---|
| 83 | $(CXX) -c $< $(TMPLCXXFLAGS) -o $@ |
---|
| 84 | |
---|
| 85 | application: application.o ftmpl_inst.o |
---|
| 86 | $(CXX) $^ $(APPLLDFLAGS) -o $@ |
---|
[d21a61] | 87 | strip $@ |
---|
| 88 | |
---|
| 89 | factorize: factorize.o ftmpl_inst.o |
---|
| 90 | $(CXX) $^ $(APPLLDFLAGS) -o $@ |
---|
| 91 | strip $@ |
---|
| 92 | |
---|
| 93 | gcd: gcd.o ftmpl_inst.o |
---|
| 94 | $(CXX) $^ $(APPLLDFLAGS) -o $@ |
---|
| 95 | strip $@ |
---|
[97ff24] | 96 | |
---|
| 97 | # clean up this directory |
---|
| 98 | clean: |
---|
| 99 | rm -f *.o $(applications) |
---|