-
Notifications
You must be signed in to change notification settings - Fork 7
/
makefile
145 lines (105 loc) · 2.2 KB
/
makefile
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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
# Constantin Knizhnik
# Moscow Software Center
# Pascal to C/C++ compiler.
#
.SUFFIXES: .cxx .c .h .o .a
default : all
#
# C/C++ compiler
#
CC = gcc
CXX = g++
#
# C/C++ flags
#
CFLAGS = -O0 -g -Wall -c
CXXFLAGS = -O0 -g -Wall -c
#CFLAGS= -fno-exceptions -O5 -g -Wall -c
#CXXFLAGS= -fno-exceptions -O5 -g -Wall -c
#
# Local packages directory
#
LOCALBASE = /usr/local
#
# Installation directory
#
PREFIX = $(LOCALBASE)
#
# Config file
#
CONFIG_FILE = $(LOCALBASE)/etc/ptoc.conf
#
# Install path
#
INSTALL_LIB_DIR = $(PREFIX)/lib
INSTALL_BIN_DIR = $(PREFIX)/bin
#
# Target.
#
BINS = ptoc cganal
LIBS = libptoc.a libXbgi.a
DEFINES =
INCLUDES = -I.
YACC = bison -Hparser.h -o parser.cxx -p zz
LEX = flex -i -F -8
#
# Chose linker You prefer.
#
LD = $(CXX)
#LDFLAGS = -non_shared
#LDFLAGS = -static
AR = ar
ARFLAGS = -ru
#
# File lists.
#
INCS = main.h token.h token.dpp nmtbl.h bring.h tpexpr.h trnod.h util.h
SRCS = trnod.cxx nmtbl.cxx bring.cxx tpexpr.cxx util.cxx main.cxx parser.cxx lex.cxx token.cxx dprintf.cxx
LIB_SRCS = set.c paslib.c io.c
OBJS = $(SRCS:.cxx=.o)
LIB_OBJS = $(LIB_SRCS:.c=.o)
#
# Default way in which source files should be compiled.
#
.cxx.o :
$(CXX) $(CXXFLAGS) $(DEFINES) $(INCLUDES) -o $@ -c $<
.c.o :
$(CC) $(CXXFLAGS) $(DEFINES) $(INCLUDES) -o $@ -c $<
#
# Custom targets.
#
$(OBJS) : $(INCS)
parser.cxx parser.h : parser.y
$(YACC) parser.y
lex.cxx : lex.l
$(LEX) lex.l
mv lex.yy.c lex.cxx
lex.o: lex.cxx token.h token.dpp
set.o: set.h ptoc.h
array.o: array.h ptoc.h
paslib.o: paslib.h ptoc.h
io.o: io.h ptoc.h
analyse.o: analyse.cxx main.h
libptoc.a: $(LIB_OBJS)
rm -f $@
$(AR) $(ARFLAGS) $@ $(LIB_OBJS)
ranlib $@
cganal : analyse.o
$(LD) $(LDFLAGS) -o $@ analyse.o
ptoc : $(OBJS)
$(LD) $(LDFLAGS) -o $@ $(OBJS)
libXbgi.a:
(cd Xbgi; make)
all : $(BINS) $(LIBS)
clean:
rm -f $(BINS) *.a a.out *.exe *.pdb *.lib *.tgz *.zip *.o lex.yy.c \
parser.tab.* WinBGI/*.pdb yy.log core y.output parser.output *~
(cd examples; make clean)
(cd Xbgi; make clean)
tgz: clean
(cd ..; tar cvzf ptoc.tgz ptoc)
copytgz: tgz
mcopy -o ../ptoc.tgz a:
install: $(BINS) $(LIBS)
cp $(BINS) $(INSTALL_BIN_DIR)
cp $(LIBS) $(INSTALL_LIB_DIR)