linux 分布式编译,distcc分布式编译

该楼层疑似违规已被系统折叠 隐藏此楼查看此楼

Makefile内容:

ver=release

mem=tcmalloc

SRCDIRS :=.

SRCEXTS :=.c .cpp .cc

HEADEXTS :=.h

CPPFLAGS :=-I. -g -fno-exceptions -Wpointer-arith -Wcast-align -Woverloaded-virtual -Wnon-virtual-dtor -Wall -Werror -Wno-deprecated -I../HBase -I/usr/inlcude/libxml2 -D_GNU_SOURCE -D_USE_CMD_NAMESPACE -D_REENTRANT `mysql_config --cflags` `xml2-config --cflags`

ifeq ($(ver), debug)

PROGRAM := libh_d.a

CPPFLAGS += -O0 -DNDEBUG

else

PROGRAM :=libh.a

CPPFLAGS += -O2 -DNDEBUG

endif

# The compiling flags used only for C.

# If it is a C++ program, no need to set these flags.

# If it is a C and C++ merging program, set these flags for the C parts.

CFLAGS :=

CFLAGS +=

# The compiling flags used only for C++.

# If it is a C program, no need to set these flags.

# If it is a C and C++ merging program, set these flags for the C++ parts.

CXXFLAGS :=

CXXFLAGS +=

# The library and the link options ( C and C++ common).

LDFLAGS :=

LDFLAGS +=

## Implict Section: change the following only when necessary.

##=============================================================================

# The C program compiler. Uncomment it to specify yours explicitly.

CC = gcc

# The C++ program compiler. Uncomment it to specify yours explicitly.

CXX = g++

GCCXML = gccxml

# Uncomment the 2 lines to compile C programs as C++ ones.

#CC = $(CXX)

#CFLAGS = $(CXXFLAGS)

# The command used to delete file.

RM = rm -f

## Stable Section: usually no need to be changed. But you can add more.

##=============================================================================

SHELL = /bin/sh

SOURCES = $(foreach d,$(SRCDIRS),$(wildcard $(addprefix $(d)/*,$(SRCEXTS))))

HEADSS = $(foreach d,$(SRCDIRS),$(wildcard $(addprefix $(d)/*,$(HEADEXTS))))

XMLS = $(foreach x,$(HEADEXTS),$(patsubst %$(x),%.xml,$(filter %$(x),$(HEADSS))))

ifeq ($(ver), debug)

OBJS = $(foreach x,$(SRCEXTS),$(patsubst %$(x),%.od,$(filter %$(x),$(SOURCES))))

DEPS = $(patsubst %.od,%.d,$(OBJS))

else

OBJS = $(foreach x,$(SRCEXTS),$(patsubst %$(x),%.o,$(filter %$(x),$(SOURCES))))

DEPS = $(patsubst %.o,%.d,$(OBJS))

endif

.PHONY : all objs clean cleanall rebuild

all : $(PROGRAM)

%.d : %.cpp

@$(CC) -MM -MD $(CPPFLAGS) $(CXXFLAGS) $<

objs : $(OBJS)

%.o : %.cpp

$(CXX) -c $(CPPFLAGS) $(CXXFLAGS) $< -o $@

%.od : %.cpp

$(CXX) -c $(CPPFLAGS) $(CXXFLAGS) $< -o $@

xmls : $(XMLS)

%.xml : %.h

$(GCCXML) $(CPPFLAGS) $(CXXFLAGS) $<

# Rules for producing the executable.

#----------------------------------------------

$(PROGRAM) : $(OBJS)

@rm -rf $(PROGRAM)

@ar cru $(PROGRAM) $(OBJS)

@ranlib $(PROGRAM)

# $(CXX) -o $(PROGRAM) $(OBJS) $(LDFLAGS)

-include $(DEPS)

rebuild: clean all

clean :

@$(RM) *.o *.od *.d

cleanall: clean

@$(RM) $(PROGRAM)

### End of the Makefile ## Suggestions are welcome ## All rights reserved ###

你可能感兴趣的:(linux,分布式编译)