[NTLUG:Discuss] gnu make

Bug Hunter bughuntr at one.ctelcom.net
Mon Feb 21 13:21:01 CST 2000


 I have a linux makefile that may do similar to what you want. It looks
like this: (notice the $^ and the $@ in the file)
---------------------------------------------------------------------
# Change it here or specify it on the "make" commandline
INCLUDEDIR = /usr/include

CFLAGS = -D__KERNEL__ -DMODULE -O -Wall -I$(INCLUDEDIR) -I ./../../

# Extract version number from headers.
VER = $(shell awk -F\" '/REL/ {print $$2}' $(INCLUDEDIR)/linux/version.h)

OBJS = sfifo.o

all: $(OBJS)

sfifo.o: sfifo_.o sfdepth.o sfmagmark.o sfifo_fifo.o sftimer.o sfmodulo.o
\
sfinterrupt.o sfifo_misc.o sfifo_lan.o
        $(LD) -r $^ -o $@

install:
        install -d /lib/modules/$(VER)/misc /lib/modules/misc
        install -c sfifo.o /lib/modules/$(VER)/misc
        install -c sfifo.o /lib/modules/misc

clean:
        rm -f *.o *~ core     

--------------------------------------------------
On Mon, 21 Feb 2000, Michael Sandfort wrote:

> 
> Sorry for the off-topic post, but I'm hoping someone can give me a quick 
> and easy fix to this. I've got some source code that I need to compile 
> with an included Makefile. 
> 
> Short version of the problem:
> Does anyone know a quick-and-dirty workaround to the fact that gnu make
> does not support the $$@ macro?
> 
> Long version: 
> The Makefile is designed to compile against a variety of setups (i.e., do
> you have software packages Matlab, Gauss, etc.).
> 
> Problem 1) When I try to compile for my setup, I get the following error 
> from gnu make:
> Makefile:170: *** target pattern contains no `%'.  Stop.
> 
> Getting rid of the offending line (it pertains to another system setup) 
> gets rid of this error, but I would like to know why it is happening. 
> Line 170 reads:
> 
> $(MATLAB_MEX): $${@:.mexsol=.o} $(MATLAB_DIR)/mexversion.o $(MATLAB_OTHER) $(OPENLIBS_Matlab) $(CLOSEDLIBS) 
> 	$(LD) $(MLDFLAGS) -o $@ ${@:.mexsol=.o} $(MATLAB_DIR)/mexversion.o \
> 	$(MATLAB_OTHER) $(OPENLIBS_Matlab) $(CLOSEDLIBS)
> 
> Problem 2) Even when the offending line is removed, I get the error:
> make: *** No rule to make target `$@.o', needed by `Unix/expect1'.  Stop.
> 
> The offending line appears to be
> 
> $(UNIXOTHER): $$@.o $(UNIXDEP) $(OPENLIBS) $(CLOSEDLIBS)
> 	$(CC) -o $@ $@.o $(UNIXOBJ) $(OPENLIBS) $(CLOSEDLIBS) -lm
> 	$(CC) -g -o $@_db $@_db.o $(UNIXOBJ_DB) $(OPENLIBS_DB) $(CLOSEDLIBS) -lm
> 
> Having read the make manual, I know that $$@ is not supported by gnu make 
> (unlike it is on SysV and BSD). Is there any way to get around this, 
> short of listing every single source/object file?
> 
> Thanks much,
> 
> Mike
> 
> 
> Michael T. Sandfort                           Phone:  214-768-3856       
> Department of Economics                       Fax:    214-768-1821
> Southern Methodist University
> 
> 
> _______________________________________________
> http://ntlug.org/mailman/listinfo/discuss
> 





More information about the Discuss mailing list