1# Makefile for building reduce suitable for embedded use. 2 3# I *HOPE* that with the following conditions and provided you yse GNU make 4# that this will build on 64-bit Linux, 64-bit Cygwin and on a Macintosh 5# that has macports installed and libffi fetched via macports. 6# I expect that other platforms might not be too hard... but some 7# will need the include/config.h file adjusted. 8 9ifeq ($(shell uname),Darwin) 10CC=g++ 11#CC=clang++ 12XCFLAGS= -I/opt/local/lib/libffi-3.2.1/include 13XLIBS=-lm 14else 15ifeq ($(shell uname -o),Cygwin) 16CC=g++ 17XLIBS=-lm 18else 19CC=g++ 20XLIBS=-lm -lpthread 21endif 22endif 23 24OPT=-O0 -g 25#OPT=-O3 26 27CPPFLAGS=$(CFLAGS) -std=gnu++11 $(OPT) -I. -I../include \ 28 -DHAVE_CONFIG_H=1 -DBUILTIN_IMAGE=1 -DEMBEDDED=1 $(XCFLAGS) 29LIBS=$(XLIBS) -lz -lffi 30 31S=../../cslbase 32R=../../.. 33 34VPATH=$(S) 35 36all: reduce 37 38reduce: allocate.o arith01.o arith02.o arith03.o arith04.o arith05.o \ 39 arith06.o arith07.o arith08.o arith09.o arith10.o \ 40 arith11.o arith12.o arith13.o arith14.o bytes.o char.o \ 41 csl.o cslmpi.o cslread.o eval1.o eval2.o eval3.o \ 42 eval4.o fasl.o fns1.o fns2.o fns3.o fwin.o cslgc.o lisphash.o \ 43 isprime.o preserve.o print.o restart.o sysfwin.o termed.o \ 44 inthash.o serialize.o stubs.o 45 $(CC) allocate.o arith01.o arith02.o arith03.o arith04.o arith05.o \ 46 arith06.o arith07.o arith08.o arith09.o arith10.o \ 47 arith11.o arith12.o arith13.o arith14.o bytes.o char.o \ 48 csl.o cslmpi.o cslread.o eval1.o eval2.o eval3.o \ 49 eval4.o fasl.o fns1.o fns2.o fns3.o fwin.o cslgc.o lisphash.o \ 50 isprime.o preserve.o print.o restart.o sysfwin.o termed.o \ 51 inthash.o serialize.o stubs.o \ 52 $(LIBS) -o reduce 53 54.cpp.o: 55 $(CC) $(CPPFLAGS) -c -o $@ $< 56 57make-image: $(S)/hexify.cpp 58 $(CC) $(CPPFLAGS) $(S)/hexify.cpp -o make-image 59 60image.cpp: make-image ../reduce.img 61 cp ../reduce.img . 62 ./make-image 63 64clean: 65 -rm -f *.o reduce hello reduce.img image.log make-image image.cpp 66 67 68HEADERS = ../include/config.h \ 69 $(S)/md5.h $(S)/termed.h $(S)/arith.h $(S)/openmath.h \ 70 $(S)/int128_t.h $(S)/bigvector.h $(S)/entries.h $(S)/proc.h \ 71 $(S)/uninames.h $(S)/bytes.h $(S)/externs.h $(S)/int128_t.h \ 72 $(S)/sockhdr.h $(S)/version.h $(S)/charmetrics.h $(S)/fwin.h \ 73 $(S)/inthash.h $(S)/stream.h $(S)/cslerror.h $(S)/headers.h \ 74 $(S)/lispthrow.h $(S)/syscsl.h $(S)/cslread.h $(S)/machine.h \ 75 $(S)/tags.h 76 77allocate.o: $(S)/allocate.cpp $(HEADERS) 78arith01.o: $(S)/arith01.cpp $(HEADERS) 79arith02.o: $(S)/arith02.cpp $(HEADERS) 80arith03.o: $(S)/arith03.cpp $(HEADERS) 81arith04.o: $(S)/arith04.cpp $(HEADERS) 82arith05.o: $(S)/arith05.cpp $(HEADERS) 83arith06.o: $(S)/arith06.cpp $(HEADERS) 84arith07.o: $(S)/arith07.cpp $(HEADERS) 85arith08.o: $(S)/arith08.cpp $(HEADERS) 86arith09.o: $(S)/arith09.cpp $(HEADERS) 87arith10.o: $(S)/arith10.cpp $(HEADERS) 88arith11.o: $(S)/arith11.cpp $(HEADERS) 89arith12.o: $(S)/arith12.cpp $(HEADERS) 90arith13.o: $(S)/arith13.cpp $(HEADERS) 91arith14.o: $(S)/arith14.cpp $(HEADERS) 92bytes.o: $(S)/bytes.cpp $(HEADERS) 93bytes1.o: $(S)/bytes1.cpp $(S)/opnames.cpp $(HEADERS) 94char.o: $(S)/char.cpp $(HEADERS) 95csl.o: $(S)/csl.cpp $(HEADERS) 96cslmpi.o: $(S)/cslmpi.cpp $(S)/mpipack.cpp $(HEADERS) 97cslread.o: $(S)/cslread.cpp $(HEADERS) 98driver.o: $(S)/driver.cpp $(HEADERS) 99embedcsl.o: $(S)/embedcsl.cpp $(S)/csl.cpp $(HEADERS) 100eval1.o: $(S)/eval1.cpp $(HEADERS) 101eval2.o: $(S)/eval2.cpp $(HEADERS) 102eval3.o: $(S)/eval3.cpp $(HEADERS) 103eval4.o: $(S)/eval4.cpp $(HEADERS) 104fasl.o: $(S)/fasl.cpp $(HEADERS) 105fns1.o: $(S)/fns1.cpp $(HEADERS) 106fns2.o: $(S)/fns2.cpp $(HEADERS) 107fns3.o: $(S)/fns3.cpp $(HEADERS) 108fwin.o: $(S)/fwin.cpp $(HEADERS) 109cslgc.o: $(S)/cslgc.cpp $(HEADERS) 110lisphash.o: $(S)/lisphash.cpp $(HEADERS) 111isprime.o: $(S)/isprime.cpp $(HEADERS) 112preserve.o: $(S)/preserve.cpp $(HEADERS) image.cpp 113print.o: $(S)/print.cpp $(HEADERS) 114restart.o: $(S)/restart.cpp machineid.cpp $(HEADERS) 115 116sysfwin.o: $(S)/sysfwin.cpp $(HEADERS) 117termed.o: $(S)/termed.cpp $(HEADERS) 118inthash.o: $(S)/inthash.cpp $(HEADERS) 119serialize.o: $(S)/serialize.cpp $(HEADERS) 120 121# end of Makefile 122