1LIB := abc
2SLIBS := lib$(LIB).a
3 SOBJECTS:= $(LIB).o
4
5
6 SRCS := $(wildcard *.c)
7 OBJS := $(patsubst %.c, %.o, $(SRCS))
8
9
10
11
12 all:: $(SLIBS)
13
14 $(SLIBS): $(OBJS)
15 @echo "--- Compiling" $(LIB) "---"
16 ar cr $(SLIBS) $^
17 ranlib $(SLIBS)
18 gcc -m32 -r -nostdlib -Wl,-X -o $(SOBJECTS) $(OBJS)
19
20
21 %.o: %.c
22 gcc -fPIC -c -Wall -g -m32 -rdynamic $(INCLUDE) $<
23
24
25 clean::
26 rm -f $(OBJS) $(SLIBS) $(SOBJECTS)
阅读(1823) | 评论(0) | 转发(0) |