| 1 |
srcdir :=$(shell pwd) |
| 2 |
|
| 3 |
#CFLAGS= -O |
| 4 |
fixed-flags = -I$(srcdir) -I$(srcdir)/box |
| 5 |
all-C-flags:= -ansi $(fixed-flags) $(CFLAGS) |
| 6 |
non-ansi-flags := $(fixed-flags) $(CFLAGS) |
| 7 |
|
| 8 |
CC = gcc # some compiler for ANSI/ISO C |
| 9 |
|
| 10 |
# These settings should also be used in subdirectories: |
| 11 |
export CC all-C-flags fixed-flags CFLAGS |
| 12 |
|
| 13 |
.SUFFIXES: |
| 14 |
|
| 15 |
%.o: %.c |
| 16 |
$(CC) -c $(CPPFLAGS) $(all-C-flags) $< |
| 17 |
|
| 18 |
common_objects=lexer.o parser.o\ |
| 19 |
non-ANSI.o bigint.o binmat.o creatop.o gettype.o getvalue.o\ |
| 20 |
init.o learn.o main.o mem.o node.o onoff.o output.o poly.o sym.o |
| 21 |
|
| 22 |
objects=$(common_objects) print.o getl.o |
| 23 |
GAP_objects=$(common_objects) gapprint.o gapgetl.o |
| 24 |
|
| 25 |
# Global organisation (phony targets) |
| 26 |
|
| 27 |
.PHONY: install all script finish no_readline |
| 28 |
.PHONY: math_functions binding_functions |
| 29 |
|
| 30 |
# The first target makes everything to get an operational LiE program |
| 31 |
install: all script INFO.a |
| 32 |
|
| 33 |
# To 'make all', we first descend into the subdirectories, and afterwards |
| 34 |
# return to finish here. |
| 35 |
|
| 36 |
all: |
| 37 |
$(MAKE) math_functions binding_functions |
| 38 |
$(MAKE) finish |
| 39 |
|
| 40 |
finish: Lie.exe LEARN.ind INFO.ind # do not call 'make finish' directly |
| 41 |
|
| 42 |
math_functions: |
| 43 |
$(MAKE) -C box all |
| 44 |
|
| 45 |
binding_functions: |
| 46 |
$(MAKE) -C static |
| 47 |
|
| 48 |
|
| 49 |
# Real dependencies |
| 50 |
|
| 51 |
# The file non-ANSI.c should be compiled without -ansi flag |
| 52 |
|
| 53 |
non-ANSI.o: non-ANSI.c |
| 54 |
$(CC) -c $(CPPFLAGS) $(non-ansi-flags) $< |
| 55 |
|
| 56 |
|
| 57 |
# These object files depend on the data types declared in those .h files: |
| 58 |
|
| 59 |
gettype.o getvalue.o init.o main.o mem.o node.o sym.o: memtype.h nodetype.h |
| 60 |
|
| 61 |
|
| 62 |
# The parser is generated by bison (BSD-yacc will NOT do) and in compilation |
| 63 |
# requires inclusion of parseaux.c (derived from parseaux.w). |
| 64 |
|
| 65 |
parser.c parser.h: parser.y |
| 66 |
bison -d --output-file=parser.c parser.y |
| 67 |
parser.o: parser.c parser.h parseaux.c |
| 68 |
|
| 69 |
lexer.o: parser.h |
| 70 |
|
| 71 |
# Binding to the GNU readline library is achieved by -Dpreprocessor below |
| 72 |
|
| 73 |
getl.o: getl.c |
| 74 |
$(CC) -c $(CPPFLAGS) -Dpreprocessor $(all-C-flags) $< |
| 75 |
gapgetl.o: getl.c |
| 76 |
$(CC) -c $(CPPFLAGS) $(all-C-flags) -o gapgetl.o $< |
| 77 |
|
| 78 |
# Though date.c never changes, it should be recompiled for each modifiaction. |
| 79 |
# Since Liegap is a separate executable, it gets its own version of the date. |
| 80 |
# Since global recompilation should be issued by 'make all' rather than by |
| 81 |
# 'make Lie.exe', we may assume here that the '.last_compiled' dates have just |
| 82 |
# been set to the most recent one of object files in the respective |
| 83 |
# subdirectories, whence taking that dummy file as dependency suffices. |
| 84 |
|
| 85 |
date.o: date.c $(objects) box/.last_compiled static/.last_compiled |
| 86 |
$(CC) -ansi -c date.c |
| 87 |
gapdate.o: date.c $(GAP_objects) box/.last_compiled static/.last_compiled |
| 88 |
$(CC) -ansi -c -o gapdate.o date.c |
| 89 |
|
| 90 |
Lie.exe: date.o |
| 91 |
$(CC) -o Lie.exe $(objects) date.o static/*.o box/*.o -lreadline |
| 92 |
chmod g+w Lie.exe |
| 93 |
Liegap.exe: gapdate.o |
| 94 |
$(CC) -o Liegap.exe $(GAP_objects) gapdate.o static/*.o box/*.o |
| 95 |
chmod g+w Liegap.exe |
| 96 |
|
| 97 |
noreadline: math_functions binding_functions $(common_objects) print.o |
| 98 |
$(CC) -c $(CPPFLAGS) $(all-C-flags) getl.c |
| 99 |
$(MAKE) date.o |
| 100 |
$(CC) -o Lie.exe $(objects) date.o static/*.o box/*.o |
| 101 |
chmod g+w Lie.exe |
| 102 |
$(MAKE) LEARN.ind INFO.ind script INFO.a |
| 103 |
|
| 104 |
script: |
| 105 |
./make_lie |
| 106 |
|
| 107 |
INFO.ind: INFO.0 INFO.1 INFO.2 INFO.3 INFO.4 infoind |
| 108 |
./infoind |
| 109 |
|
| 110 |
LEARN.ind: LEARN learnind |
| 111 |
./learnind |
| 112 |
|
| 113 |
infoind: util/infoind.c |
| 114 |
$(MAKE) -C util ../infoind |
| 115 |
learnind: util/learnind.c |
| 116 |
$(MAKE) -C util ../learnind |
| 117 |
|
| 118 |
INFO.a: progs/maxsub progs/maxsub0 progs/eqrank |
| 119 |
rm -f INFO.a |
| 120 |
./Lie.exe < progs/maxsub |
| 121 |
|
| 122 |
.PHONY: clean |
| 123 |
clean: |
| 124 |
$(MAKE) -C box clean |
| 125 |
$(MAKE) -C static clean |
| 126 |
rm -f *~ *.o parser.[ch] INFO.a LEARN.ind |
| 127 |
rm -f Lie.exe Liegap.exe infoind learnind util/*.o |