Path: utzoo!utgpu!watmath!clyde!att!ihlpb!gregg From: gregg@ihlpb.ATT.COM (Wonderly) Newsgroups: comp.sources.wanted Subject: Re: Makefile Generator Wanted Message-ID: <9224@ihlpb.ATT.COM> Date: 19 Dec 88 17:34:10 GMT References: <487@gonzo.UUCP> Organization: AT&T Bell Laboratories - Naperville, Illinois Lines: 52 From article <487@gonzo.UUCP>, by daveb@gonzo.UUCP (Dave Brower): > In article <2269@mergvax> rkxyv@mergvax (Rob Kedoin) writes: >>Does anyone know of any Public Domain makefile generator ? >> >>My problem is that programmers(myself included) occasionally forget to >>add dependencies into their Makefiles. I am looking for a tool that >>will somehow create/verify a Makefile so I can be confident that no >>dependencies have been forgotten. >> >>I would like information on non-public domain programs if anyone has >>it. > > ... > > If you only need to add dependencies, rather than create the makefile > from scratch, the 4.3 "cc" command has a -M option that spits out > makefile dependiencies for the specified files to stdout. (This is > actually a feature of /lib/cpp). It is a feature of every cc(1) that will run cpp... try cc -E file.c | grep '^#' | sed '1,$s/^[^"]*"//;s/"$//' | sort -u | \ ( echo "file.o : \c" # change as needed for you version of sh # echo -n "file.o : " while read x do echo "\\\n\t$x \c" # change as needed for you version of sh # echo -n "\\\n\t$x " done echo '' exit 0 ) Which generated for me... file.o : \ ./defs.h \ ./extern.h \ ./struct.h \ /usr/include/assert.h \ /usr/include/ctype.h \ /usr/include/stdio.h \ /usr/include/string.h \ /usr/include/sys/types.h \ file.c -- It isn't the DREAM that NASA's missing... DOMAIN: gregg@ihlpb.att.com It's a direction! UUCP: att!ihlpb!gregg