-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
43 lines (31 loc) · 814 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
LIBPROMISE_DIR:=$(shell pwd)
BUILD_DIR=$(LIBPROMISE_DIR)/build/
CFLAGS?=-O3
override CFLAGS+=-MMD -MP
LDFLAGS?=
STATIC_LIB=libpromise.a
LIB_SRC=promise.c
PACK_LIBS=libmap.a
.PHONY:all
all:lib
.PHONY:lib
lib:$(STATIC_LIB)
$(STATIC_LIB):$(patsubst %.c,$(BUILD_DIR)%.o,$(LIB_SRC)) $(patsubst %.a,$(BUILD_DIR)%,$(PACK_LIBS))
$(AR) -rcs $@ $(patsubst %.c,$(BUILD_DIR)%.o,$(LIB_SRC))
$(AR) -qcs $@ $(patsubst %.a,$(BUILD_DIR)%/*,$(PACK_LIBS))
$(BUILD_DIR)libmap.a:
$(MAKE) -C map lib
cp map/libmap.a $@
$(BUILD_DIR):
mkdir -p $(BUILD_DIR)
$(BUILD_DIR)lib%:$(BUILD_DIR)lib%.a
mkdir -p $@
cd $@; ar -x $<
$(BUILD_DIR)%.o:%.c | $(BUILD_DIR)
$(CC) $(CFLAGS) -o $@ -c $<
-include $(patsubst %.c,$(BUILD_DIR)/%.d,$(SRC))
.PHONY:clean
clean:
$(MAKE) -C map clean
rm -rf $(BUILD_DIR)
rm -f $(STATIC_LIB)