-
Notifications
You must be signed in to change notification settings - Fork 11
/
Makefile
39 lines (32 loc) · 922 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
RM := rm
CP := cp
HOME := $(shell echo ${GSF_HOME})
CC := $(shell echo ${GSF_CC})
AR := $(shell echo ${GSF_AR})
CFLAGS := $(shell echo ${GSF_CFLAGS})
#library;
LDFLAGS := -shared -g
TARG := lib/libgfs.so
#test;
#LDFLAGS := -g
#TARG := tt
#LIBS += -lpthread
#CFLAGS += -DDEBUG
#=============================================================
INCS := -Isrc -Iinc
SRCS := $(shell ls src/*.c)
OBJS := $(patsubst %.c, %.o, $(SRCS))
LIBS +=
DEP_OBJS := OBJS
DEP_LIBS +=
$(TARG): $(OBJS)
$(RM) lib/$(DEP_OBJS) -rf
$(foreach a, $(DEP_LIBS), cd lib; $(AR) -t $(a) | sed 's/^/lib\//' >> $(DEP_OBJS); $(AR) x $(a); cd ..;)
${CC} ${LDFLAGS} -o $@ ${OBJS} `cat lib/$(DEP_OBJS)` ${LIBS}
rm -rf `cat lib/$(DEP_OBJS)`; rm -rf lib/$(DEP_OBJS);
cp $(TARG) $(HOME)/lib/$(GSF_CPU_ARCH)/ -v
.c.o:
$(CC) $(CFLAGS) -c $< $(INCS) -o $@
.Phony: clean
clean:
-rm $(TARG) $(OBJS) src/*.bak -rf