-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
72 lines (49 loc) · 1.73 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
62
63
64
65
66
67
68
69
70
71
72
BISON = bison
FLEX = flex
MKDIR = mkdir
SRCDIR = src
LIBDIR = lib
INCDIR = include
BUILDDIR = build
OXPLLIBDIR = $(LIBDIR)/oxpl
ONTGLIBDIR = $(LIBDIR)/ontg
OXPLINCDIR = $(INCDIR)/oxpl
ONTGINCDIR = $(INCDIR)/ontg
OXPLBUILDDIR = $(BUILDDIR)/oxpl
ONTGBUILDDIR = $(BUILDDIR)/ontg
SRCS = src/main.c src/shell.c src/exec.c
CCFLAGS = -g
OXPLLIBOBJS = $(OXPLBUILDDIR)/ast.o $(OXPLBUILDDIR)/builtin.o\
$(OXPLBUILDDIR)/lex.yy.o $(OXPLBUILDDIR)/parse.tab.o
ONTGLIBOBJS = $(ONTGBUILDDIR)/onto.o
OXPLBISONH = $(OXPLBUILDDIR)/parse.tab.h
OXPLBISONP = $(OXPLBUILDDIR)/parse.tab.c
# BINS
build/ontc : $(SRCS) build/libontg.a build/liboxpl.a
$(CC) $(CCFLAGS) -I$(SRCDIR) -I$(BUILDDIR)/oxpl -I$(OXPLINCDIR) \
-I$(ONTGINCDIR) -Lbuild -lontg -loxpl -o $(BUILDDIR)/ontc $^
# OXPL
$(OXPLBUILDDIR)/lex.yy.c : lib/oxpl/lex.l $(OXPLBISONH) | $(OXPLBUILDDIR)
$(FLEX) -o $@ $<
$(OXPLBISONP) $(OXPLBISONH) : lib/oxpl/parse.y | $(OXPLBUILDDIR)
$(BISON) -o $@ --defines=$(OXPLBUILDDIR)/parse.tab.h $<
$(OXPLBUILDDIR)/%.o : lib/oxpl/%.c $(OXPLBISONP) $(OXPLBISONH) | $(OXPLBUILDDIR)
$(CC) $(CCFLAGS) -I$(OXPLINCDIR) -I$(OXPLLIBDIR) -c -o $@ $<
$(OXPLBUILDDIR)/%.yy.o : $(OXPLBUILDDIR)/%.yy.c | $(OXPLBUILDDIR)
$(CC) $(CCFLAGS) -I$(OXPLINCDIR) -I$(OXPLLIBDIR) -c -o $@ $<
$(OXPLBUILDDIR)/%.tab.o : $(OXPLBUILDDIR)/%.tab.c | $(OXPLBUILDDIR)
$(CC) $(CCFLAGS) -I$(OXPLINCDIR) -I$(OXPLLIBDIR) -c -o $@ $<
# ONTG
$(ONTGBUILDDIR)/%.o : $(ONTGLIBDIR)/%.c | $(ONTGBUILDDIR)
$(CC) $(CCFLAGS) -I$(ONTGINCDIR) -I$(ONTGLIBDIR) -c -o $@ $<
# LIBS
build/liboxpl.a : $(OXPLLIBOBJS) | $(OXPLBUILDDIR)
$(AR) rcs $@ $^
build/libontg.a : $(ONTGLIBOBJS) | $(ONTGBUILDDIR)
$(AR) rcs $@ $^
# DIRS
$(OXPLBUILDDIR) $(ONTGBUILDDIR) :
$(MKDIR) -p $@
.PHONY: clean
clean :
-rm -r build/*