What's wrong with this picture (makefile bug?)

M.LAI gdsd1 at homxb.UUCP
Sat Mar 16 03:07:00 AEST 1985


[munch munch]


>		I seem to have run into a strange "make" problem involving user
>	defined suffixes. I started with a makefile:
>	
>		.SUFFIXES: .qc
>	
>		.qc.c:
>			cat $< >mtest.c
>	
>		mtest: mtest.o
>			cc -o mtest mtest.o
>	
>	and a file "mtest.qc". If I say "make mtest" - it comes back "don't know
>	how to make mtest.o". However if I do "make mtest.c" and then "make mtest"
>	it works fine.

Try:

.SUFFIXES: .qc

.qc:
	cat $< > $(?:.qc=.c)
	$(CC) $(CFLAGS) -o $@ $(?:.qc=.c)
	@rm $(?:.qc=.c)

and you won't need to specify any dependencies.  Just:

	$ make mtest
	cat mtest.qc > mtest.c
	cc -O -o mtest mtest.c

Neal Nuckolls
..!houxa!homxb!gdsd1



More information about the Comp.unix.wizards mailing list