-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
55 lines (41 loc) · 1.18 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
# author: François Cayre <cayre@yiking.(null)>
TARGET=scheme
ROOTDIR=sfsn
DIRNAME=`basename $(PWD)`
CC=`which gcc`
LD=`which gcc`
RM=`which rm` -f
SRCDIR=src
INCDIR=include
TESTDIR=testing
GARBAGE=*~ $(SRCDIR)/*~ $(INCDIR)/*~ $(TESTDIR)/*~
INCLUDE=-I$(INCDIR)
CFLAGS=-Wall -ansi $(INCLUDE)
LFLAGS=-lreadline -lm
CFLAGS_DBG=$(CFLAGS) -g -DVERBOSE -DDEBUG -Wall
CFLAGS_RLS=$(CFLAGS) -DVERBOSE
SRC=$(wildcard $(SRCDIR)/*.c)
OBJ_DBG=$(SRC:.c=.dbg)
OBJ_RLS=$(SRC:.c=.rls)
all :
@echo "in " $(DIRNAME)
@echo ""
@echo "Usage:"
@echo ""
@echo "make debug => build DEBUG version"
@echo "make release => build RELEASE version"
@echo "make clean => clean everything"
@echo "make tarball => produce archive"
debug : $(OBJ_DBG)
$(LD) $^ $(LFLAGS) -o $(TARGET)
release : $(OBJ_RLS)
$(LD) $^ $(LFLAGS) -o $(TARGET)
%.dbg : %.c
$(CC) $< $(CFLAGS_DBG) -c -o $(basename $<).dbg
%.rls : %.c
$(CC) $< $(CFLAGS_RLS) -c -o $(basename $<).rls
clean :
$(RM) $(TARGET) $(SRCDIR)/*.orig $(SRCDIR)/*.dbg $(SRCDIR)/*.rls $(GARBAGE) scheme-`whoami`-*.tgz
tarball :
make clean
cd .. && tar -czvf scheme-`whoami`-`date +%d-%m-%H-%M`.tgz $(DIRNAME) && cd $(DIRNAME) && mv ../scheme-`whoami`-*.tgz .