author | Markus Bröker <mbroeker@volpe.spectre.org> |
Wed, 18 Aug 2010 16:15:18 +0200 | |
changeset 141 | 0b5befeb361e |
parent 66 | 2b4f786d9073 |
permissions | -rw-r--r-- |
66
2b4f786d9073
Common Makefile Style NAME += OBJECT
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
37
diff
changeset
|
1 |
CC = gcc |
2b4f786d9073
Common Makefile Style NAME += OBJECT
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
37
diff
changeset
|
2 |
LD = ld |
2b4f786d9073
Common Makefile Style NAME += OBJECT
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
37
diff
changeset
|
3 |
YACC = bison -v |
2b4f786d9073
Common Makefile Style NAME += OBJECT
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
37
diff
changeset
|
4 |
FLEX = flex |
2b4f786d9073
Common Makefile Style NAME += OBJECT
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
37
diff
changeset
|
5 |
CFLAGS = -Wall -O2 -ansi -D_XOPEN_SOURCE=500 |
2b4f786d9073
Common Makefile Style NAME += OBJECT
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
37
diff
changeset
|
6 |
LDFLAGS = |
2b4f786d9073
Common Makefile Style NAME += OBJECT
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
37
diff
changeset
|
7 |
INCLUDE = -Iinclude |
2b4f786d9073
Common Makefile Style NAME += OBJECT
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
37
diff
changeset
|
8 |
|
2b4f786d9073
Common Makefile Style NAME += OBJECT
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
37
diff
changeset
|
9 |
OBJECTS = main.o |
2b4f786d9073
Common Makefile Style NAME += OBJECT
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
37
diff
changeset
|
10 |
OBJECTS += parser.o |
2b4f786d9073
Common Makefile Style NAME += OBJECT
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
37
diff
changeset
|
11 |
OBJECTS += lexer.o |
2b4f786d9073
Common Makefile Style NAME += OBJECT
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
37
diff
changeset
|
12 |
|
37 | 13 |
TARGET=mcc |
14 |
||
15 |
.SUFFIXES: .c .y .l |
|
16 |
||
17 |
.c.o: |
|
66
2b4f786d9073
Common Makefile Style NAME += OBJECT
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
37
diff
changeset
|
18 |
$(CC) -c $(CFLAGS) $(INCLUDE) $(CONFIG) $< |
37 | 19 |
|
20 |
.y.c: |
|
21 |
$(YACC) -d $< -o $@ |
|
22 |
||
23 |
.l.c: |
|
24 |
$(FLEX) -o $@ $< |
|
25 |
||
26 |
all: $(TARGET) |
|
27 |
||
28 |
||
29 |
$(TARGET): $(OBJECTS) |
|
30 |
$(CC) $(CFLAGS) $(LDFLAGS) $(OBJECTS) -o $@ |
|
31 |
||
32 |
.PHONY: distclean clean indent |
|
33 |
||
34 |
clean: |
|
35 |
rm -f *.[oae]; |
|
36 |
rm -f *~; |
|
37 |
||
38 |
distclean: |
|
39 |
make clean |
|
40 |
rm -f $(TARGET) |
|
41 |
rm -f parser.h |
|
42 |
rm -f parser.output |
|
43 |
||
44 |
indent: |
|
45 |
indent *.c *.h |
|
46 |
eraser *.c *.h |
|
47 |
||
48 |
install: $(TARGET) |
|
49 |
[[ -x ~/bin/ ]] && cp -f $(TARGET) ~/bin |
|
50 |