parser/c_compiler/Makefile
changeset 37 0fbbe329c3a2
child 66 2b4f786d9073
equal deleted inserted replaced
36:f52a9deddfc0 37:0fbbe329c3a2
       
     1 CC=gcc
       
     2 LD=ld
       
     3 YACC=bison -v
       
     4 FLEX=flex
       
     5 CFLAGS=-Wall -O2 -ansi -D_XOPEN_SOURCE=500
       
     6 LDFLAGS=
       
     7 INCLUDE=include
       
     8 OBJECTS=main.o parser.o lexer.o
       
     9 TARGET=mcc
       
    10 
       
    11 .SUFFIXES: .c .y .l
       
    12 
       
    13 .c.o:
       
    14 	$(CC) -c $(CFLAGS) -I$(INCLUDE) $(CONFIG) $<
       
    15 
       
    16 .y.c:
       
    17 	$(YACC) -d $< -o $@
       
    18 
       
    19 .l.c:
       
    20 	$(FLEX) -o $@ $<
       
    21 
       
    22 all: $(TARGET)
       
    23 
       
    24 
       
    25 $(TARGET): $(OBJECTS)
       
    26 	$(CC) $(CFLAGS) $(LDFLAGS) $(OBJECTS) -o $@
       
    27 
       
    28 .PHONY: distclean clean indent
       
    29 
       
    30 clean:
       
    31 	rm -f *.[oae];
       
    32 	rm -f *~;
       
    33 
       
    34 distclean:
       
    35 	make clean
       
    36 	rm -f $(TARGET)
       
    37 	rm -f parser.h
       
    38 	rm -f parser.output
       
    39 
       
    40 indent:
       
    41 	indent *.c *.h
       
    42 	eraser *.c *.h
       
    43 
       
    44 install: $(TARGET)
       
    45 	[[ -x ~/bin/ ]] && cp -f $(TARGET) ~/bin
       
    46