jack@stevie.cs.unlv.edu (Jack Alexander) (12/29/89)
Hello: I have a need for a make-type program that will allow recompilations to be dependent on the changing of compiler definitions (i.e., "-DVERSIONB") The problem is that I have many megabytes of code that have to support many, many different versions of basically the same program. Because I want to keep the guts of the system the same, whereever a slight modification is needed for a particular version, I just make the code segment conditional using #ifdef's, #ifndef's, etc. However, when I change a compile variable, I don't want to re-compile every file (some directories may have 50 source files each), just the ones that actually reference the variable. Has anybody heard of any such program? Does anybody else need such a program? If the need is terrific, I may endeavor to hack it into gnu make. If I do this, I would appreciate any recommendations. -- Jack Alexander
silvert@cs.dal.ca (Bill Silvert) (12/29/89)
In article <1440@jimi.cs.unlv.edu> jack@jimi.cs.unlv.edu (Jack Alexander) writes: >I have a need for a make-type program that will allow recompilations >to be dependent on the changing of compiler definitions (i.e., "-DVERSIONB") >... However, when I change >a compile variable, I don't want to re-compile every file (some directories may >have 50 source files each), just the ones that actually reference the variable. It seems that this should be doable with existing forms of make. Arrange to set each define in a file (use `cat ...` to get the contents into the command line) and set up dependencies. Then when you edit the file "versionb" (containing just the line "-DVERSIONB") the appropriate files get remade. The dependencies can be set up either by hacking an existing dependency generator or by using greps. -- Bill Silvert, Habitat Ecology Division. Bedford Institute of Oceanography, Dartmouth, NS, Canada B2Y 4A2 UUCP: ...!{uunet,watmath}!dalcs!biomel!bill Internet: biomel@cs.dal.CA BITNET: bs%dalcs@dalac.BITNET
shenkin@cunixc.cc.columbia.edu (Peter S. Shenkin) (12/29/89)
In article <1440@jimi.cs.unlv.edu> jack@jimi.cs.unlv.edu (Jack Alexander) writes: >I have a need for a make-type program that will allow recompilations >to be dependent on the changing of compiler definitions (i.e., "-DVERSIONB") > ....when I change >a compile variable, I don't want to re-compile every file (some directories may >have 50 source files each), just the ones that actually reference the variable. How about this solution, using ordinary make. You write a shell script which does an fgrep on the .c (and/or .h) files, searching for the definition in question -- e.g., "VERSIONB" -- then "touch"es each file in which it is found. You have a special target in the make file which you invoke whenever you want to recompile everything that depends on this. This target first runs the script, then "make"s the program target. There are complications, but something like this ought to be doable; at worst, you'd need a separate target for each -D you expect to invoke from the commandline. For example, you could have target "VERSIONB:". Then, if you said "make -DVERSIONB VERSIONB" the VERSIONB: target would first do the fgrep on VERSIONB & touch, then make the program. You could even define a csh "alias makeD make -D\!* \!*" which would work, provided you only gave it a single -D. More elegant solutions would be necessary if you wanted to either use more than one -D at once or else have a single target that would work no matter what the -D, but you get the idea.... -P. -P. ************************f*u*cn*rd*ths*u*cn*gt*a*gd*jb************************** Peter S. Shenkin, Department of Chemistry, Barnard College, New York, NY 10027 (212)854-1418 shenkin@cunixc.cc.columbia.edu(Internet) shenkin@cunixc(Bitnet)
davidsen@sixhub.UUCP (Wm E. Davidsen Jr) (12/30/89)
You can sort of do this now. You can put the defines in a separate header file and have your main header file include them, setting dependencies for each source which must change, or you can make a dummy item which you touch when you change the define, then make objects depend on it. None of this is automatic, but it is portable. # these change when OS is redefined OSLIST = part2.o random.o report3.o # touch osdef.inc when the OS define is changed $(OSLIST):: osdef.inc I think a portable program to go through files and generate some list of defines used would be more useful to you and others. -- bill davidsen - sysop *IX BBS and Public Access UNIX davidsen@sixhub.uucp ...!uunet!crdgw1!sixhub!davidsen "Getting old is bad, but it beats the hell out of the alternative" -anon
kcantrel@digi.UUCP (Keith Cantrell) (01/04/90)
In article <1440@jimi.cs.unlv.edu> jack@jimi.cs.unlv.edu (Jack Alexander) writes:
Jack>
Jack>Hello:
Jack>
Jack>I have a need for a make-type program that will allow recompilations
Jack>to be dependent on the changing of compiler definitions (i.e., "-DVERSIONB")
Jack>The problem is that I have many megabytes of code that have to support
Jack>many, many different versions of basically the same program. Because I
Jack>want to keep the guts of the system the same, whereever a slight
Jack>modification is needed for a particular version, I just make the code
Jack>segment conditional using #ifdef's, #ifndef's, etc. However, when I change
Jack>a compile variable, I don't want to re-compile every file (some directories may
Jack>have 50 source files each), just the ones that actually reference the variable.
Jack>
Jack>Has anybody heard of any such program? Does anybody else need such a program?
Jack>If the need is terrific, I may endeavor to hack it into gnu make. If I do
Jack>this, I would appreciate any recommendations.
Jack>
Jack>-- Jack Alexander
Yes, go out and buy an Apollo and use DSEE. It keeps up with not only the
version of source that goes into making an object, but all the command(s), and
options to the commands, as well.
Keith
-----------------------------------------------------------------------
Keith Cantrell Phones: hm: 214-492-1088
wk: 214-519-2399
USMAIL: EMAIL:
2100 Sonata Ln cantrell@attctc.DALLAS.TX.US
Carrollton TX 75007 or
...!attctc!digi!kcantrel
-----------------------------------------------------------------------