-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
61 lines (45 loc) · 1.04 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
#
# Makefile for AmigaOS4 version of awk.
#
.PHONY: all clean debug
CRT = newlib
CC = gcc
YACC = yacc
STRIP = strip -R.comment $@
RM = rm -f
CP = cp
OPTIMIZE = -O3
WARNING = -Wall -Wwrite-strings
CFLAGS = -mcrt=$(CRT) $(OPTIMIZE) $(WARNING)
CPPFLAGS = -mcrt=$(CRT) -D__USE_INLINE__ -DAUTOINIT
LDFLAGS = -mcrt=$(CRT)
LIBS = -lm -lunix
SRCS = ytab.c lex.c b.c main.c parse.c proctab.c tran.c lib.c run.c environ.c
OBJS = $(SRCS:.c=.o)
DEPS = $(OBJS:.o=.d)
all: ytab.c proctab.c maketab awk nawk
@echo done.
debug: CFLAGS += -ggdb
debug: LDFLAGS += -ggdb
debug: STRIP =
debug: OPTIMIZE =
debug: all
nawk:
$(CP) awk nawk
awk: $(OBJS)
$(CC) $(LDFLAGS) -o $@ $(OBJS) $(LIBS)
$(STRIP)
ytab.c: awkgram.y
$(YACC) -d awkgram.y
rename y.tab.c ytab.c
rename y.tab.h ytab.h
proctab.c: maketab
./maketab >./proctab.c
maketab: ytab.h maketab.c
$(CC) $(CFLAGS) maketab.c -o $@
%.o : %.c
$(CC) -MM -MP $(INCDIRS) $< >$*.d
$(CC) -c $(CPPFLAGS) -I. $(CFLAGS) $<
clean:
$(RM) awk nawk $(OBJS) $(DEPS) proctab.c maketab ytab.c ytab.h
-include $(SRCS:.c=.d)