Good ideas :-), no time :-(

Courageous jkraska1 at san.rr.com
Thu May 25 04:14:17 CEST 2000


> All is relative, you know.  The complexity is inherent to some setup,
> and `make' is no magician to reduce that complexity, which it then ought
> to represent.  This is inescapable.

*Shrug*. Look into combining wildcarding with suffix substitution.
For example, this GNUMakefile builds an entire server. Basically
the SRC:= line says "every cap-C file in this directory", and the
OBJ:= line says "substitute every .C file with a .o equivalent
including a directory prefix of whatever $OBJDIR is". So dozens of
.C files get built with this makefile. I use something similar
for libraries (which builds both static and dynamic versions):

#################################################################################

include $(PROJECTDIR)/project.mk
include $(MAKEINFO)/basic
include $(MAKEINFO)/cc
include $(MAKEINFO)/world.proj

#################################################################################
##   DRAFT TARGETS
#################################################################################

SRC    := $(shell echo *.C)
OBJ    := $(SRC:%.C=$(OBJDIR)/%.o)
EXE    := $(BINDIR)/wrldsrv.exe

#################################################################################
##  TARGETS
#################################################################################

local: dirs $(EXE) 

dirs:
	mkdir -p ./$(OBJDIR)

$(EXE): $(OBJ) 
	$(CC) $(OBJ) -o $@ $(LFLAGS) $(LIBS) $(LASTLIBS) 

$(OBJDIR)/%.o: %.C
	$(CC) -c $(CFLAGS) $(DEBUGF) $(IFLAGS) $(DEFINES) $< -o $@



What's notable is that I can generally drop this makefile into just
about any .C source directory and have stuff up and compiled on very
short notice. Most source directories are either an executable or a
library, I've found. For combination directories, it get's tougher
of course, but in my experience, the *better* thing to do is to break
out the combination directory into seperate directories, keeping
everything infinitely manageable.

While I seldom toot my own horn about anything, managing very large
source (multiple platform, multiple language, multiple configuration)
is something I'm very, very good at, so I hope you appreciate it when
I say that GNUmake is one of the very best build tools I've ever found
for anything like this.

IT REALLY ROCKS.




C/



More information about the Python-list mailing list