[distcc] One machine compile only

Frerich Raabe raabe at kde.org
Mon Oct 13 16:39:14 GMT 2003


Am Monday 13 October 2003 16:05 schrieb Piero B. Contezini:
> Ahm, Make -j8 dont actually do this?
> My Makefile is quite simple:

[..]

> server:
> 	$(CC) -c -o procmcast.o procmcast.cpp $(INCLUDE)
> 	$(CC) -c -o proctcppacket.o proctcppacket.cpp $(INCLUDE)
> 	$(CC) -c -o data.o data.cpp $(INCLUDE)
> 	$(CC) -c -o server.o main.cpp $(INCLUDE)
> 	$(CC) -c -o pdata.o pdata.cpp $(INCLUDE)
> 	$(CC) -o server server.o procmcast.o proctcppacket.o data.o pdata.o
> $(EOBJECTS) $(ARCHIVES) $(LDFLAGS) -lstdc++

This is a clumsy construct and makes it very hard (if not impossible, as your 
case suggests) to paralellize things. Better use something like this:

%.o: %.cpp
	$(CXX) -c -o $@ $<

server: procmcast.o proctcppacket.o data.o server.o pdata.o
	$(CXX) -o server $^ $(EOBJECTS) $(ARCHIVES) $(LDFLAGS)

This is a lot less to type and should achieve the same - and make it possible 
for make to paralellize things, because now each .cpp -> .o step is a rule of 
it's own and thus can be outsourced.

- Frerich

P.S.: You don't need to link against libstdc++ by hand, g++ does that 
automatically.

-- 
"If you fail to adjust your notion of fairness to the reality of the Universe, 
you will probably not be happy." - Paratima, of http://free-dc.org fame



More information about the distcc mailing list