Article View: gnu.misc.discuss
Article #72161Re: Installing GNU tools on non-Sun/BSD platforms
From: David S. Herron
Date: Tue, 14 Apr 1992 17:39
Date: Tue, 14 Apr 1992 17:39
132 lines
6284 bytes
6284 bytes
In article <1992Apr07.235640.11049@mixcom.com> calyx.corp@mixcom.mixcom.com (calyx.corp) writes:
>Regarding GNU CVS 3.0 on various platforms, I can't even get it to compile
>on Unix System V 3.2. The makefile is self-modifying, generating
>dependency information using the BSD/Sun -M option to cc, for which
>no equivalent exists in the standard SVR3 development kits.
Bzzzt! Wrong... The SVR3 development kits (er.. SVR3.2 anyway) include
enough stuff to do the equivalent to BSD's -M flag. The following stuff
is from the MMDF distribution and was written by me about 3 years ago.
The first part is a crufty "Find all the #include lines and make the
object file be dependant on *all* of the ones mentioned.". It is a
starting point, if your compiler does not support the nifty new keano
features of modern cc's.
The second part is the interesting one. It includes two flavors of
doing the same thing, simply {,un}comment the appropriate parts and
go with it.
BTW: I make no claim of ownership on this. It was written while
I was a student/system-admin at the University of Kentucky and
written for the purpose of including in the Official MMDF source tree
(which I maintained at the time).
(You'll have to reinsert the blanks.. the R4 xterm doesn't preserve
those on cut&paste..)
I urge the GNU people to incorporate this into their Makefile's...
David
#
# #include dependencies
#
# Two versions are supplied. One for sites with cc support
# and one for those that don't have it. Comment out the one
# you do not want.
# This one is for sites without cc support.
#
# Note that this one blindly greps out all the include lines regardless
# of whether or not they are actually active. This will almost
# certainly make too many dependencies and make(1) will complain that
# it cannot make certain files in /usr/include. Usually you can just
# delete the reference to the file and go on. [DSH]
#
#depend:
# cat </dev/null >x.c
# for i in $(MODULES); do \
# (echo $$i.o: $$i.c >>makedep; \
# grep '^#[ ]*include' x.c $$i.c | sed \
# -e 's,c:[^"]*"\./\([^"]*\)".*,o: \1,' \
# -e 's,c:[^"]*"/\([^"]*\)".*,o: /\1,' \
# -e 's,c:[^"]*"\([^"]*\)".*,o: ../../h/\1,' \
# -e 's,c:[^<]*<\(.*\)>.*,o: /usr/include/\1,' \
# >>makedep); done
# echo '/^# DO NOT DELETE THIS LINE/+2,$$d' >eddep
# echo '$$r makedep' >>eddep
# echo 'w' >>eddep
# cp Makefile.real Makefile.bak
# ed - Makefile.real < eddep
# rm eddep makedep x.c
# echo '# DEPENDENCIES MUST END AT END OF FILE' >> Makefile.real
# echo '# IF YOU PUT STUFF HERE IT WILL GO AWAY' >> Makefile.real
# echo '# see make depend above' >> Makefile.real
# This one is for sites with cc support
#
# This macro contains the option for cc to turn on the dependency generation.
#
# Known values:
#
# 4.3BSD -M
# Ultrix v3 (?) -Em
# SysV r3.2 (?) -E -H
#
# (?) -- not exactly sure of versions.
#
THE_M_FLAG= -M
#
depend:
#
# This section is for cc's which generate dependencies already in the
# format needed for a Makefile. The awk incantation puts as many
# dependencies per line as are reasonable, and is the same as the awk
# incantation in the other half of this section. [DSH]
#
( for i in ${MODULES} ; do \
${CC} ${THE_M_FLAG} ${CFLAGS} $$i.c ; done ) | \
awk ' { if ($$1 != prev) { print rec; rec = $$0; prev = $$1; } \
else { if (length(rec $$2) > 78) { print rec; rec = $$0; } \
else rec = rec " " $$2 } } \
END { print rec } ' > makedep
#
# This section is for cc's which merely generate a list of included
# files. The first awk incantation masages that output into the
# "file.o: file.c" preferred by make, and the second is the one above
# for prettying things up. Note in the first incantion that error
# messages are assumed to have greater than one "field", and also
# are printed on the terminal. Oh for a /dev/std{out,err} ... [DSH]
#
# ( for i in ${MODULES} ; do \
# echo $$i >/tmp/curfile; echo "$$i.o: $$i.c" ; \
# ${CC} ${THE_M_FLAG} ${CFLAGS} $$i.c >/dev/null 2>$$i.deps; \
# awk <$$i.deps 'NF > 1 { print >"/dev/tty"; next } \
# {print "'`cat /tmp/curfile`'.o: " $$1}' ; \
# rm -f $$i.deps $$i.out; done ) | \
# awk ' { if ($$1 != prev) { print rec; rec = $$0; prev = $$1; } \
# else { if (length(rec $$2) > 78) { print rec; rec = $$0; } \
# else rec = rec " " $$2 } } \
# END { print rec } ' > makedep
#
# This section is common to both and edits the Makefile to include
# the dependencies generated by one of the two methods above. [DSH]
#
echo '/^# DO NOT DELETE THIS LINE/+2,$$d' >eddep
echo '$$r makedep' >>eddep
echo 'w' >>eddep
cp Makefile.real Makefile.bak
ed - Makefile.real < eddep
rm eddep makedep
echo '# DEPENDENCIES MUST END AT END OF FILE' >> Makefile.real
echo '# IF YOU PUT STUFF HERE IT WILL GO AWAY' >> Makefile.real
echo '# see make depend above' >> Makefile.real
--
<- David Herron, an MMDF & WIN/MHS guy, <david@twg.com>
<-
<- As for the prevalence of gratuitous stupidity in modern life, well,
<- need I say more than "MS-DOS"? -- Bill Janssen
Technical Details
Message-ID:
<10310@gollum.twg.com>Path:
arc1-ca.pugleaf.net!sparky!uunet!think.com!rpi!ispd-newsserver!psinntp!eco.twg.com!twg.com!davidReferences:
<1992Apr3.183342.6206@ux1.cso.uiuc.edu> <1992Apr07.235640.11049@mixcom.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 1025b4,e71ffc4241e1c053 X-Google-Attributes: gid1025b4,public X-Google-ArrivalTime: 1992-04-18 10:33:25 PST Path: arc1-ca.pugleaf.net!sparky!uunet!think.com!rpi!ispd-newsserver!psinntp!eco.twg.com!twg.com!david From: david@twg.com (David S. Herron) Newsgroups: gnu.misc.discuss Subject: Re: Installing GNU tools on non-Sun/BSD platforms Keywords: GNU, RCS, platforms Message-ID: <10310@gollum.twg.com> Date: 14 Apr 92 17:39:57 GMT References: <1992Apr3.183342.6206@ux1.cso.uiuc.edu> <1992Apr07.235640.11049@mixcom.com> Distribution: usa Organization: The Wollongong Group, Palo Alto, CA Lines: 132