File: Makefile

package info (click to toggle)
lie 2.2.2%2Bdfsg-4
  • links: PTS
  • area: main
  • in suites: sid, trixie
  • size: 1,036 kB
  • sloc: ansic: 12,761; yacc: 395; makefile: 111; sh: 4
file content (127 lines) | stat: -rw-r--r-- 3,544 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
srcdir     :=$(shell pwd)

#CFLAGS= -O
fixed-flags = -I$(srcdir) -I$(srcdir)/box
all-C-flags:= -ansi $(fixed-flags) $(CFLAGS)
non-ansi-flags :=  $(fixed-flags) $(CFLAGS)

CC = gcc # some compiler for ANSI/ISO C

# These settings should also be used in subdirectories:
export CC all-C-flags fixed-flags CFLAGS

.SUFFIXES:

%.o: %.c
	$(CC) -c $(CPPFLAGS) $(all-C-flags) $<

common_objects=lexer.o parser.o\
 non-ANSI.o bigint.o binmat.o creatop.o gettype.o getvalue.o\
 init.o learn.o main.o mem.o node.o onoff.o output.o poly.o sym.o

objects=$(common_objects) print.o getl.o
GAP_objects=$(common_objects) gapprint.o gapgetl.o

# Global organisation (phony targets)

.PHONY: install all script finish no_readline
.PHONY:	math_functions binding_functions

# The first target makes everything to get an operational LiE program
install: all script INFO.a

# To 'make all', we first descend into the subdirectories, and afterwards
# return to finish here.

all:
	$(MAKE) math_functions binding_functions
	$(MAKE) finish

finish: Lie.exe LEARN.ind INFO.ind # do not call 'make finish' directly

math_functions:
	$(MAKE) -C box all

binding_functions:
	$(MAKE) -C static


# Real dependencies 

# The file non-ANSI.c should be compiled without -ansi flag

non-ANSI.o: non-ANSI.c
	$(CC) -c $(CPPFLAGS) $(non-ansi-flags) $<


# These object files depend on the data types declared in those .h files:

gettype.o getvalue.o init.o main.o mem.o node.o sym.o: memtype.h nodetype.h


# The parser is generated by bison (BSD-yacc will NOT do) and in compilation
# requires inclusion of parseaux.c (derived from parseaux.w).

parser.c parser.h: parser.y
	bison -d --output-file=parser.c parser.y
parser.o: parser.c parser.h parseaux.c

lexer.o: parser.h

# Binding to the GNU readline library is achieved by -Dpreprocessor below

getl.o:	getl.c
	$(CC) -c $(CPPFLAGS) -Dpreprocessor $(all-C-flags) $<
gapgetl.o: getl.c
	$(CC) -c $(CPPFLAGS) $(all-C-flags) -o gapgetl.o $<

# Though date.c never changes, it should be recompiled for each modifiaction.
# Since Liegap is a separate executable, it gets its own version of the date.
# Since global recompilation should be issued by 'make all' rather than by
# 'make Lie.exe', we may assume here that the '.last_compiled' dates have just
# been set to the most recent one of object files in the respective
# subdirectories, whence taking that dummy file as dependency suffices.

date.o: date.c $(objects) math_functions binding_functions
	$(CC) -ansi -c date.c
gapdate.o: date.c $(GAP_objects) math_functions binding_functions
	$(CC) -ansi -c -o gapdate.o date.c

Lie.exe: date.o
	$(CC) -o Lie.exe $(objects) date.o static/*.o box/*.o -lreadline
	chmod g+w Lie.exe
Liegap.exe: gapdate.o
	$(CC) -o Liegap.exe $(GAP_objects) gapdate.o static/*.o box/*.o
	chmod g+w Liegap.exe

noreadline: math_functions binding_functions $(common_objects) print.o
	$(CC) -c $(CPPFLAGS) $(all-C-flags) getl.c
	$(MAKE) date.o
	$(CC) -o Lie.exe $(objects) date.o static/*.o box/*.o
	chmod g+w Lie.exe
	$(MAKE) LEARN.ind INFO.ind script INFO.a

script:
	./make_lie

INFO.ind:	INFO.0 INFO.1 INFO.2 INFO.3 INFO.4 infoind
	./infoind

LEARN.ind:	LEARN learnind
	./learnind

infoind: util/infoind.c
	$(MAKE) -C util ../infoind
learnind: util/learnind.c
	$(MAKE) -C util ../learnind

INFO.a: progs/maxsub progs/maxsub0 progs/eqrank Lie.exe
	rm -f INFO.a
	./Lie.exe < progs/maxsub

.PHONY: clean
clean:
	$(MAKE) -C box clean
	$(MAKE) -C static clean
	rm -f *~ *.o parser.[ch] INFO.a LEARN.ind
	rm -f Lie.exe Liegap.exe infoind learnind util/*.o