~brenns10/funlisp

ref: 346874b165ff60236fe82742a0ffacb415b6b7ec funlisp/Makefile -rw-r--r-- 742 bytes
346874b1Stephen Brennan A hello world 3 years ago
                                                                                
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
# funlisp - Makefile
#
# Stephen Brennan <stephen@brennan.io>

.PHONY: all clean

CC=gcc
CFLAGS= -std=c89 -Wall -Wextra -fPIC -Iinc -c
SRCS=$(wildcard src/*.c)
OBJS=$(patsubst src/%.c,obj/%.o,$(SRCS))

# Debug mode (make D=1): adds "debugging symbols" etc
D=0
ifeq ($(D),1)
CFLAGS += -g -DDEBUG
endif

all: bin/libfunlisp.a

obj/%.o: src/%.c
	$(CC) $(CFLAGS) -c $< -o $@

obj/%.o: tools/%.c
	$(CC) $(CFLAGS) -c $< -o $@

bin/libfunlisp.a: $(OBJS)
	ar rcs $@ $^

bin/repl: obj/repl.o bin/libfunlisp.a
	$(CC) -ledit $^ -o $@

bin/runfile:  obj/runfile.o bin/libfunlisp.a
	$(CC) $^ -o $@

clean:
	rm -rf obj/* bin/*

depend: $(SRCS) src/*.h inc/*.h tools/*.c
	$(CC) $(CFLAGS) -MM obj $(SRCS) | sed 's!^\(.*\):!obj/\1:!' > depend

include depend