Linux 编译脚本

#Makefile

#Makefile Common
#author zhangb

CC           = g++ 
LD           = ld
LDSO         = $(CC) -shared -nostartfiles
CFLAGS       = -fPIC -Wall -Wno-unused -D_REENTRANT -O2
LINKFLAGS    = -lpthread -lz 

CINCLUDE    += -I. \
LINKFLAGS   += 
LIBSMAIN    += -L. \
LIBSRUN        += -WI, rpath=/opt/apps/lib

OBJSMAIN    = main.o

MAIN    = process

# Complie all

all: $(MAIN)

$(MAIN): $(OBJSMAIN)
    $(RM) $(MAIN)
    $(CC) $^ $(LIBSMAIN) $(LINKFLAGS) $(LIBSRUN) -o $(MAIN)
    
clean:
    $(RM) $(MAIN) $(OBJSMAIN)

%.o: %.c
    $(CC) -c  -o $@ $? 
%.o: %.cpp
    $(CC) -c  -o $@ $? 

#build.sh

#!/bin/sh
export LANG=en_US.UTF-8

g++ -o kmtest kmtest.cpp -lpthread -lstdc++ -ldl -WI,rpath=/opt/lib
echo "编译完成"

#Confiure的生成命令

aclocal

autoconfig

automake --add-missing

你可能感兴趣的:(c++,c++,linux,makefile,c语言)