views:

29

answers:

1

hi,

I have a list of RPM file names (like "package-1.0") that will be the dependencies of a make target, but some of them have the architecture x86_64 and others have i386. what do I do to match them? I need something like:

target: $(addsuffix .[i386|x86_64].rpm,$(shell cat packages_file))

but that won't work. I could use:

target: $(addsuffix .*.rpm,$(shell cat packages_file))

but that won't match another target in the Makefile (package-1.0.*.rpm will rarely exist, it would trigger another target that would actually generate that file, but with the * it doesn't work).

any suggestions?

EDIT:

making it clearer: I want the target below to be executed (display "yay!") if one of the files x.txt, y.txt or z.txt exists.

target: [x|y|z].txt
    @echo yay!
A: 

Regex handling is high on my wishlist for Make. Here is a kludge:

RPM = $(wildcard x.txt y.txt z.txt)

ifeq ($(RPM),)
# What do you want to do if these files don't exist?
else
target: $(RPM)
    @echo yay! (I see $^)
endif
Beta