-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
42 lines (32 loc) · 844 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
LIBSIMDIRS = libsim
LIBZBASEDIRS = libzbase
INCLUDES = $(LIBSIMDIRS):$(LIBZBASEDIRS)
LIBSIM = $(LIBSIMDIRS)/libsim.a
LIBZBASE = $(LIBZBASEDIRS)/libzbase.a
CC = gcc
CFLAGS = -c -O3
LIBS = -lm
TMPDIR = mk.tmp
BINSRCS = ztest.c
BINOBJS = $(BINSRCS:%.c=$(TMPDIR)/%.o)
OUTBIN = ztest
.PHONY: all
all : libzbase $(OUTBIN)
.PHONY: clean
clean:
@echo; echo "cleaning ..."
rm -rf $(TMPDIR)
rm -rf $(OUTBIN)
cd $(LIBZBASEDIRS); make clean
$(OUTBIN): $(BINOBJS) $(LIBSIM) $(LIBZBASE) | libzbase
@echo; echo "[LD] linking ..."
cc -I$(LIBSIMDIRS) -I$(LIBZBASEDIRS) -o $@ $^
$(BINOBJS): $(LIBZBASE) Makefile
$(BINOBJS): $(TMPDIR)/%.o:%.c | $(TMPDIR)
@echo; echo "[CC] compiling: $< "
$(CC) $(CFLAGS) -I$(LIBSIMDIRS) -I$(LIBZBASEDIRS) -o $@ $<
.PHONY: libzbase
libzbase $(LIBZBASE):
cd $(LIBZBASEDIRS); make
$(TMPDIR):
mkdir $(TMPDIR)