常用的一个简单生成静态库的makefile

#=============================================
# Makefile (linux) for S21SDK Sample : testnc
#=============================================

SHELL = /bin/sh

CC = mipsel-linux-gcc
AR = mipsel-linux-ar


CCSIPDIR ?= $(shell cd "../../" && pwd)
CFLAG = -O2 -W -Wall
INCPATH = -I./include -I./src -I../../../include/ -I$(CCSIPDIR)/Common/include -I$(CCSIPDIR)/include

TEST_TARGET = ./lib/libNtp1.a
TEST_OBJ = csip_ntp.o
TEST_SRC = ./src/csip_ntp.c

all : $(TEST_TARGET)

$(TEST_OBJ): $(TEST_SRC)
$(CC) $(CFLAG) $(INCPATH) -c $(TEST_SRC)

$(TEST_TARGET) : $(TEST_OBJ)
$(AR) cq $@ $^
#$(AR) $(TRGLINKOPT) cq $@ $^
#$(CC) -o $@ $(TEST_OBJ) $(LIBS)

# clean
clean:
rm -f *.o $(TEST_TARGET)

你可能感兴趣的:(C++,c,linux,gcc,C#)