help-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: 'Generic' pattern rules


From: marc
Subject: Re: 'Generic' pattern rules
Date: Thu, 25 Aug 2011 16:07:08 +0200
User-agent: Roundcube Webmail/0.5.1

Sure. Here is a subset of the actual Makefile:

----BEGIN----

OPENSSL = openssl
KEYSIZE = 2048
SUBJECT = /CN=foobar

.EXPORT_ALL_VARIABLES:

%.key:
        $(OPENSSL) genrsa -out $@ $(KEYSIZE)

%.req: %.key
        $(OPENSSL) req -out $@ -key $< -subj $(SUBJECT) -new -batch

carbon.req: carbon.key

hydrogen.req: SUBJECT = /CN=hydrogen.example.com
hydrogen.req: myrsa2048.key

----END----

When 'make carbon.req' is executed, 'carbon.key' is first created if not already present (first pattern rule), and then 'carbon.req'

However, when 'make hydrogen.req' is executed, 'myrsa2048.key' is not taken into account since the pattern rule is meant to match 'hydrogen.req: hydrogen.key'.

The only solution I found so far is to use canned recipes instead of pattern rules. But that's not that elegant...

There is probably a complicated way to most (but not all) of what
you're trying to do. Can you give a more detailed example that's
closer to your actual use case?





reply via email to

[Prev in Thread] Current Thread [Next in Thread]