david@monymsys.uucp (David Kozinn) (11/08/89)
From somewhere in the dark recesses of my mind, I seem to remember that there's some way to specify what some of the rules are that make uses. I know that in the absence of a [Mm]akefile, there are a set of rules that are used to determine how to build a program. The default set of rules defines something like : .c.o: $(CC) ..... blah blah Here's the problem: I'm running Microport Sys V/386 and using the Green Hills C compiler. I would prefer that instead of the default value of "cc" being used for the $CC macro that gcc be used instead. For the time being, when I make something I've done something like "make CC=gcc foobar", which works just fine, but is a minor annoyance. I've looked around for a makefile in some place logical (like /etc or /usr/lib) but can't find one. Aside from creating an alias (or equivalent) for make, is there some simple way that I can change these defaults? Thanks. -- David Kozinn | UUCP: {rutgers | uunet}!cbmvax!cgh!monymys!david MONY Financial Services | UUCP: ...!rutgers!princeton!mccc!monymsys!david Glenpointe Center West | Internet: cgh!monymsys!david@manta.pha.pa.us Mail Drop 75-14 | GEnie: D.KOZINN Teaneck, NJ 07666-6888 | Telephone: +1-201-907-6990
cpcahil@virtech.uucp (Conor P. Cahill) (11/10/89)
In article <1989Nov8.033800.5104@monymsys.uucp>, david@monymsys.uucp (David Kozinn) writes: > Here's the problem: I'm running Microport Sys V/386 and using the Green Hills > C compiler. I would prefer that instead of the default value of "cc" being > used for the $CC macro that gcc be used instead. For the time being, when I > make something I've done something like "make CC=gcc foobar", which works just > fine, but is a minor annoyance. How about: CC=gcc; export CC # in your .profile. So: make fobar # will use gcc for $(CC) This should work fine under system V/386. > I've looked around for a makefile in some > place logical (like /etc or /usr/lib) but can't find one. Aside from creating > an alias (or equivalent) for make, is there some simple way that I can change > these defaults? Thanks. There isn't a default makefile on the system, the other rules are built into make itself, so to modify them you need to be able to recompile make. -- +-----------------------------------------------------------------------+ | Conor P. Cahill uunet!virtech!cpcahil 703-430-9247 ! | Virtual Technologies Inc., P. O. Box 876, Sterling, VA 22170 | +-----------------------------------------------------------------------+
martin@mwtech.UUCP (Martin Weitzel) (11/10/89)
In article <1989Nov8.033800.5104@monymsys.uucp> david@monymsys.UUCP (David Kozinn) writes: [stuff deleted] >Here's the problem: I'm running Microport Sys V/386 and using the Green Hills >C compiler. I would prefer that instead of the default value of "cc" being [stuff deleted] To my knowledge, most implementations of make have this rules "compiled in". But besides defining CC as shell variable and *exporting* it (which makes it unnecessary to repeat it on every call to make), many implementations of make support an include mechanism (sometimes undocumented, but try, it might work though). Simply say: include filename (no # like in C, no "..." around filame). So, you may set up some central file with your prefered suffix rules anywhere and include it in project specific Makefiles. The latter approach is most useful, if you have to change something not yet "parametrized" by the use of make-macros (= exported shell variables).
vandys@hpcupt1.HP.COM (Andrew Valencia(Seattle)) (11/11/89)
Another simple way is to have a makefile that just contains the line: CC= gcc Now make will read this, otherwise using its default environment. Andy
bill@twwells.com (T. William Wells) (11/11/89)
In article <1989Nov8.033800.5104@monymsys.uucp> david@monymsys.UUCP (David Kozinn) writes:
: make something I've done something like "make CC=gcc foobar", which works just
: fine, but is a minor annoyance. I've looked around for a makefile in some
You can just set a shell variable CC. That is what I do..
As in (Bourne shell):
CC=gcc; export CC
then run make. I just put this into my .profile and forgot it.
BTW, it works for other make variables as well.
Fixing it in make is not going to be easy: the built in rules are
compiled into make.
An alternate is to get a PD make and use that instead. Assuming
you can find one that is a complete and robust implementation.
Caveat Usor: Many are not.
Oh, another thing: you can't use the shared libraries if you link
with gcc, you have to use cc instead. This leads to my make files
having CC and LDCC, with CC=gcc and LDCC=cc, so that I can add
LDLIB=-lc_s. Another pain is profiling. It doesn't work with gcc
and 3.0e. The fix in the manual is incorrect. I did, however,
create a fix. All of which I'm about to discard: Gnu C 1.36 seems
to work fine, though its optimizer can be an amazing hog. No
doubt I'll have similar irritations with it, but at least I have
the source so I can do the fixes right!
---
Bill { uunet | novavax | ankh | sunvice } !twwells!bill
bill@twwells.com
scjones@sdrc.UUCP (Larry Jones) (11/11/89)
In article <1989Nov8.033800.5104@monymsys.uucp>, david@monymsys.uucp (David Kozinn) writes: > Here's the problem: I'm running Microport Sys V/386 and using the Green Hills > C compiler. I would prefer that instead of the default value of "cc" being > used for the $CC macro that gcc be used instead. For the time being, when I > make something I've done something like "make CC=gcc foobar", which works just > fine, but is a minor annoyance. I've looked around for a makefile in some > place logical (like /etc or /usr/lib) but can't find one. Aside from creating > an alias (or equivalent) for make, is there some simple way that I can change > these defaults? Thanks. Unfortunately, according to the man page for make "The internal rules for make are contained in the source file rules.c for the make program," which sort of leaves out those of us without sources. There are a number of make sources which are generally available, one was just posted to one of the comp.sources groups a week or so ago. Perhaps you could track down one of them. ---- Larry Jones UUCP: uunet!sdrc!scjones SDRC scjones@SDRC.UU.NET 2000 Eastman Dr. BIX: ltl Milford, OH 45150-2789 AT&T: (513) 576-2070 "You know how Einstein got bad grades as a kid? Well MINE are even WORSE!" -Calvin
allbery@NCoast.ORG (Brandon S. Allbery) (11/11/89)
As quoted from <1989Nov8.033800.5104@monymsys.uucp> by david@monymsys.uucp (David Kozinn): +--------------- | Here's the problem: I'm running Microport Sys V/386 and using the Green Hills | C compiler. I would prefer that instead of the default value of "cc" being | used for the $CC macro that gcc be used instead. For the time being, when I | make something I've done something like "make CC=gcc foobar", which works just | fine, but is a minor annoyance. I've looked around for a makefile in some +--------------- Make's rules are built in. However, you can always resort to: csh: setenv CC gcc sh: CC=gcc; export CC ++Brandon -- Brandon S. Allbery allbery@NCoast.ORG, BALLBERY (MCI Mail), ALLBERY (Delphi) uunet!hal.cwru.edu!ncoast!allbery ncoast!allbery@hal.cwru.edu bsa@telotech.uucp *(comp.sources.misc mail to comp-sources-misc[-request]@backbone.site, please)* *Third party vote-collection service: send mail to allbery@uunet.uu.net (ONLY)* expnet.all: Experiments in *net management and organization. Mail me for info.
david@monymsys.uucp (David Kozinn) (11/13/89)
Thanks for all the replies to this, both via mail and in news. The consensus seems to be that the simplest way to do this is to simply put the lines: CC=gcc export CC in my .profile to be executed at login, and all will work as desired. (It does!) A number of people pointed out that make -p will display the set of rules that apply, and that if you have the source to make (which I don't), then you can modify the default rules used in rules.c and recompile. Finally, for project- specific things, simply putting a CC=gcc line in the project makefile will work well. Thanks again for all the replies. -- David Kozinn | UUCP: {rutgers | uunet}!cbmvax!cgh!monymys!david MONY Financial Services | UUCP: ...!rutgers!princeton!mccc!monymsys!david Glenpointe Center West | Internet: cgh!monymsys!david@manta.pha.pa.us Mail Drop 75-14 | GEnie: D.KOZINN Teaneck, NJ 07666-6888 | Telephone: +1-201-907-6990
plocher@sally.Sun.COM (John Plocher) (11/16/89)
+-- In <1989Nov10.191703.8167@twwells.com> bill@twwells.com (T. William Wells) writes | Oh, another thing: you can't use the shared libraries if you link | with gcc, you have to use cc instead. This leads to my make files +---- There was a "fix" for this - it involved the fact that crt0.o is used by ghc and crt0.o is for static libraries. You need to use crt1.o *.o *.a crtn.o (i.e., crt1.o is the first thing linked, and crtn.o is the last). These startup files include the initialization support for shared libraries. In other words, a standard static link order is crt0.o foo.o libc.a and the equivalent shared library link order is crt1.o foo.o libc_s.a crtn.o -John Plocher PS, it doesn't hurt to use crt1.o ... crtn.o with static libraries so it can safely be made the default.