generated from 8dcc/c-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
51 lines (36 loc) · 1.01 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
CC=gcc
CFLAGS=-std=gnu99 -Wall -Wextra -ggdb3
LDLIBS=-lm
SRC=main.c \
env.c expr.c lambda.c \
util.c error.c debug.c \
read.c lexer.c parser.c eval.c \
prim_special.c prim_general.c prim_logic.c prim_type.c prim_list.c \
prim_string.c prim_arith.c prim_bitwise.c prim_io.c
OBJ=$(addprefix obj/, $(addsuffix .o, $(SRC)))
BIN=sl
LIB=stdlib.lisp
PREFIX=/usr/local
BINDIR=$(PREFIX)/bin
LIBDIR=$(PREFIX)/lib/sl
#-------------------------------------------------------------------------------
.PHONY: all clean install install-bin install-lib doc
all: $(BIN)
clean:
rm -f $(OBJ)
rm -f $(BIN)
install: install-bin install-lib
install-bin: $(BIN)
mkdir -p $(BINDIR)
install -m 755 $^ $(BINDIR)
install-lib: $(LIB)
mkdir -p $(LIBDIR)
install -m 644 $^ $(LIBDIR)
doc:
make --directory=doc clean all
#-------------------------------------------------------------------------------
$(BIN): $(OBJ)
$(CC) $(CFLAGS) -o $@ $^ $(LDLIBS)
obj/%.c.o : src/%.c
@mkdir -p $(dir $@)
$(CC) $(CFLAGS) -o $@ -c $<