make difficulties

Brandon S. Allbery KB8JRR allbery at NCoast.ORG
Sat Jan 12 14:50:33 AEST 1991


As quoted from <1050 at maestro.queensu.CA> by levisonm at 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 at 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



More information about the Comp.unix.programmer mailing list