187a690a55291b513c797d799d9b2886238f1e19
[YACASL2.git] / src / Makefile
1 INCLUDE = ../include
2 CC = gcc
3 CFLAGS = -g -Wall -I $(INCLUDE)
4
5 COMMONSRC = word.c cmem.c cerr.c
6 CASL2SRC = struct.c cmd.c hash.c
7 ASSRC = assemble.c token.c label.c
8 EXECSRC = exec.c dump.c
9
10 .PHONY: all clean
11
12 all: ../casl2 ../comet2 ../dumpword
13
14 ../casl2: casl2.o $(subst .c,.o,$(COMMONSRC) $(CASL2SRC) $(ASSRC) $(EXECSRC))
15         $(CC) $(CFLAGS) -o $@ $^
16
17 ../comet2: comet2.o $(subst .c,.o,$(COMMONSRC) $(CASL2SRC) $(EXECSRC))
18         $(CC) $(CFLAGS) -o $@ $^
19
20 ../dumpword: dumpword.o $(subst .c,.o,$(COMMONSRC))
21         $(CC) $(CFLAGS) -o $@ $^
22
23 %.o: %.c
24         $(CC) -c $(CFLAGS) $<
25
26 %.d: %.c
27         @$(CC) -MM -I $(INCLUDE) $< | sed 's/\($*\.o\):/\1 $@:/g' >$@
28
29 -include $(subst .c,.d,casl2.c comet2.c dumpword.c $(COMMONSRC) $(CASL2SRC) $(ASSRC) $(EXECSRC))
30
31 TAGS: $(INCLUDE)/*.h *.c
32         @if test `which etags`; then etags $^; fi
33
34 clean:
35         @rm -f ../casl2 ../comet2 ../dumpword *.o *.d