Makefile 动态库与静态库的引用示例

# ---------------------------------------------------------------------------
# platform dependencies
# ---------------------------------------------------------------------------
CC          = powerpc-linux-gcc 
CXX         = powerpc-linux-g++

# ---------------------------------------------------------------------------
# project specifics
# ---------------------------------------------------------------------------
MAPFILE         = lcd.map
ADD_INCLUDE = -I./xml/include
CFLAGS          = -Wall -Wl,-Map,$(MAPFILE) $(ADD_INCLUDE)
#CFLAGS      = -Wl,-Map,$(MAPFILE) $(ADD_INCLUDE)
#LDLIBS         = -lpthread ./libiconv-1.8/lib/libiconv.a ./libcurl-7.20.0/lib/libcurl.a -lrt
LDLIBS    = -lpthread ./libiconv-1.8/lib/libiconv.a -L./xml/lib -lxml2

TGT         = lcd_12864 
CSRC        = lcd.c main.c zimo.c key.c sound.c profile.c myWork.c global.c xml.c#network.c
OBJS        = $(CSRC:.c=.o) $(ASRC:.S=.o)
DEPS        = $(OBJS:.o=.d) $(NOLINK_OBJS:.o=.d)
BIN         = $(TGT)

.PHONY: clean all

all: $(BIN)

$(BIN): $(OBJS)
        $(CC) $(CFLAGS) $(OBJS) $(LDLIBS) -o $@

clean:
        rm -f $(DEPS)
        rm -f $(OBJS) $(NOLINK_OBJS)
        rm -f $(BIN)
        rm -f $(MAPFILE)

# ---------------------------------------------------------------------------
# rules for code generation
# ---------------------------------------------------------------------------
%.o:    %.c
        $(CC) $(CFLAGS) -o $@ -c $<

%.o:    %.S
        $(CC) $(ASFLAGS) -o $@ -c $<

你可能感兴趣的:(Makefile 动态库与静态库的引用示例)