Path: utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!uunet!snorkelwacker.mit.edu!usc!wuarchive!ukma!usenet.ins.cwru.edu!ncoast!allbery From: allbery@NCoast.ORG (Brandon S. Allbery KB8JRR) Newsgroups: comp.unix.programmer Subject: Re: make difficulties Message-ID: <1991Jan12.035033.29535@NCoast.ORG> Date: 12 Jan 91 03:50:33 GMT References: <1050@maestro.queensu.CA> Reply-To: allbery@ncoast.ORG (Brandon S. Allbery KB8JRR) Followup-To: comp.unix.programmer Organization: North Coast Computer Resources (ncoast) Lines: 36 As quoted from <1050@maestro.queensu.CA> by levisonm@qucis.queensu.CA (Mark Levison): +--------------- | set correctly for each source compilation. The problem comes from the | fact that this requires 3 sets of rules for each executable | | profiles/pr:~$(PR_OBJECTS) $(LIB_DEP) | ~gcc -pg $(OPT) -o $@ $(PR_OBJECTS) $(LIB_PATH) $(LIBS) | ~beep | | debug/pr:~$(PR_DB_OBJECTS) | ~cc -g -o $@ $(PR_DB_OBJECTS) $(DB_LIB_PATH) $(DB_LIBS) | ~beep | | clean/pr:~$(PR_OBJECTS) $(LIB_DEP) | ~gcc $(OPT) -o $@ $(PR_OBJECTS) $(LIB_PATH) $(LIBS) | ~beep +--------------- Make doesn't handle this sort of thing too well. Two possibilities: (1) Use four Makefiles --- one each for profiles, debug, and clean, which define macros, and a fourth which is included into the other three and defines the actual rules in terms of those macros. "make -f profiles.mk", for example, would build the profiling version. Drawback: since make doesn't realize you're playing games, you must "touch" the sourrce files to force recompilation from one form to another. (2) Get the "shape" distribution from the comp.sources.unix archives. It has built-in support for this sort of thing, as well as many other features. ++Brandon -- Me: Brandon S. Allbery VHF/UHF: KB8JRR on 220, 2m, 440 Internet: allbery@NCoast.ORG Packet: KB8JRR @ WA8BXN America OnLine: KB8JRR AMPR: KB8JRR.AmPR.ORG [44.70.4.88] uunet!usenet.ins.cwru.edu!ncoast!allbery Delphi: ALLBERY