-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
50 lines (37 loc) · 834 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
38
39
40
41
42
43
44
45
46
47
48
49
# Compiler
CC=gcc
BISON_CC=bison
# Compiler flags
INCLUDES=
READLINE_LIB=-lcurses -lreadline
CFLAGS=-c -Wall -std=gnu99 $(INCLUDES)
LDFLAGS=-lm $(READLINE_LIB)
# Bison parser source
BISON_SOURCE=parser.y
# Parser pre-builds
BISON_PRE_BUILD=parser.c
# Sources
SOURCES=$(BISON_PRE_BUILD)\
shell.c\
executor.c\
builtin.c\
tasks.c
HEADERS=shell.h\
parseline.h\
executor.h\
builtin.h\
tasks.h
# Compiler output
OBJECTS=$(SOURCES:.c=.o)
EXECUTABLE=yxsh
all: bison $(HEADERS) $(SOURCES) $(EXECUTABLE)
$(EXECUTABLE): $(OBJECTS)
$(CC) $(OBJECTS) -o $@ $(LDFLAGS)
%.o: %.c Makefile
$(CC) $(CFLAGS) $< -o $@
bison: $(BISON_SOURCE)
$(BISON_CC) -o $(BISON_PRE_BUILD) $(BISON_SOURCE)
clean:
rm -rf $(OBJECTS) $(EXECUTABLE) $(BISON_PRE_BUILD) $(BISON_PRE_BUILD:.c=.h)
clear: clean
rebuild: clean all