-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
37 lines (25 loc) · 850 Bytes
/
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
IDIR=include
CC=gcc
CFLAGS=-I$(IDIR) -g
ODIR=obj
LDIR=lib
LIBS=-lm
_DEPS=lexer.h parser.h list.h hashmap.h ast_printer.h tac_generator.h tac_interpreter.h string_builder.h asm_generator.h asm_templates.h
DEPS=$(patsubst %,$(IDIR)/%,$(_DEPS))
_TEST_DEPS=list.h
TEST_DEPS=$(patsubst %,$(IDIR)/%,$(_TEST_DEPS))
_OBJ=main.o lexer.o parser.o list.o hashmap.o ast_printer.o tac_generator.o tac_interpreter.o string_builder.o asm_generator.o asm_templates.o
OBJ=$(patsubst %,$(ODIR)/%,$(_OBJ))
_TEST_OBJ=test.o list.o
TEST_OBJ=$(patsubst %,$(ODIR)/%,$(_TEST_OBJ))
$(ODIR)/%.o: %.c $(DEPS)
$(CC) -c -o $@ $< $(CFLAGS)
$(ODIR)/%.o: %.c $(TEST_DEPS)
$(CC) -c -o $@ $< $(CFLAGS)
mishmash: $(OBJ)
$(CC) -o $@ $^ $(CFLAGS) $(LIBS)
testmash: $(TEST_OBJ)
$(CC) -o $@ $^ $(CFLAGS) $(LIBS)
.PHONY: clean
clean:
rm -f $(ODIR)/*.o *~ core $(INCDIR)/*~