From: ian_d AT elric DOT accuris DOT ie (Ian Dunbarr) Newsgroups: comp.os.msdos.djgpp Subject: Re: How do I do this with make? Date: 16 Jan 1998 18:17:16 GMT Organization: Telecom Internet, Dublin, Ireland. Lines: 93 Message-ID: References: <69nuae$492$1 AT star DOT cs DOT vu DOT nl> NNTP-Posting-Host: 159.134.174.252 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk In article <69nuae$492$1 AT star DOT cs DOT vu DOT nl>, Ruiter de M wrote: >I think this is not DJGPP- or DOS-specific, but I hope you are kind >enough to answer my question here anyway. :-) > >I want to do, in a makefile: > ># -*- makefile -*- >10/%.enc: 10/%.jpg > same commands >20/%.enc: 20/%.jpg > same commands >... >90/%.enc: 90/%.jpg > same commands > >That is, the commands depend of course on $^ or $@, so strictly they >are not the same. What I hope to do is to use ONE dependancy in ONE >makefile in ONE run of `make' to handle this, because the names of the >dirs can change and I want them in a variable. I have tried all sorts >of things but it was not possible. > >For instance: > >%/a.enc %/b.enc ....: %/a.jpg %/b.jpg .... > same commands > >This doesn't work (I know this dependancy means something else, every >.enc depends on all .jpg's now, but that's not too important), because >somehow the %/ is `stripped off' the %/*.jpg somehow. The (make.info) >documentation says something like that, but I'm not sure what and why. > >Any ideas? >-- >Groeten, Michel. http://www.cs.vu.nl/~mdruiter > \----/==\----/ > \ / \ / "You know, Beavis, you need things that suck, > \/ \/ to have things that are cool", Butt-Head. I'm not sure if I've understood what you are trying to do properly, but here's my attempt anyway. Maybe it will help even if it's not exactly what you want. Ian. ############################################################################## # Makefile for .enc files from .jpg files in some arbitrary directory # # By Ian Dunbar ############################################################################## ############################################################################## # Set the default directory (override this on the make command line) # for example: # make "MYDIR=20" # should do the make in dir 20. (does the command line stuff work in dos?) ############################################################################## MYDIR=10 ############################################################################## # The source files for the enc files ############################################################################## JSRCS= a.jpg b.jpg ############################################################################## # prepend the direcory name and a / # so a.jpg goes to 10/a.jpg etc... ############################################################################## JSRCS=$(JSRCS/^/${MYDIR}\//) ############################################################################## # The final format for the files # replace .jpg with .enc ############################################################################## JFINAL=$(JSRCS:.jpg=.enc) ############################################################################## # Suffix rules. How to compile convert from jpg to enc # # REM: replace the dummy command with whatever is the proper command ############################################################################## .SUFFIXES: .jpg .enc .jpg.enc: dummy.exe $< ############################################################################## # Set the target dependency ############################################################################## target: $(JFINAL) ############################################################################## # end of makefile ##############################################################################