Skip to main content
replaced http://stackoverflow.com/ with https://stackoverflow.com/
Source Link
URL Rewriter Bot
URL Rewriter Bot

I have some .c and .h files that are generated by a script based on one XML file and optionally another XML file.

From what I've read I should be able to use a wildcard, for example:

%Generated.c %Generated.h : %Compulsory.xml $(wildcard %Optional.xml)
   generation-script $< $*

The files XXXGenerated.c/h are being regenerated when I change XXXCompulsory.xml but not when I change XXXOptional.xml. Does anyone know why?

I can get around the problem with duplicate rules as follows:

%Generated.c %Generated.h : %Compulsory.xml
   generation-script $< $*

%Generated.c %Generated.h : %Compulsory.xml %Optional.xml
   generation-script $< $*

but I would have thought there was a better way to specify an optional dependency?

Thanks!

Note: This same question has been asked before (e.g. How to manage C header file dependencies?How to manage C header file dependencies? ) but in this case I can't have the compiler generate a .d file.

Edit: The location for Optional.xml is fine because it works if I specify only the rule:

%Generated.c %Generated.h : %Compulsory.xml %Optional.xml
   generation-script $< $*

And try to compile only for a target which Optional.xml exists.

But I've noticed that doesn't work with the parenthesis:

%Generated.c %Generated.h : %Compulsory.xml $(%Optional.xml)
   generation-script $< $*

I have some .c and .h files that are generated by a script based on one XML file and optionally another XML file.

From what I've read I should be able to use a wildcard, for example:

%Generated.c %Generated.h : %Compulsory.xml $(wildcard %Optional.xml)
   generation-script $< $*

The files XXXGenerated.c/h are being regenerated when I change XXXCompulsory.xml but not when I change XXXOptional.xml. Does anyone know why?

I can get around the problem with duplicate rules as follows:

%Generated.c %Generated.h : %Compulsory.xml
   generation-script $< $*

%Generated.c %Generated.h : %Compulsory.xml %Optional.xml
   generation-script $< $*

but I would have thought there was a better way to specify an optional dependency?

Thanks!

Note: This same question has been asked before (e.g. How to manage C header file dependencies? ) but in this case I can't have the compiler generate a .d file.

Edit: The location for Optional.xml is fine because it works if I specify only the rule:

%Generated.c %Generated.h : %Compulsory.xml %Optional.xml
   generation-script $< $*

And try to compile only for a target which Optional.xml exists.

But I've noticed that doesn't work with the parenthesis:

%Generated.c %Generated.h : %Compulsory.xml $(%Optional.xml)
   generation-script $< $*

I have some .c and .h files that are generated by a script based on one XML file and optionally another XML file.

From what I've read I should be able to use a wildcard, for example:

%Generated.c %Generated.h : %Compulsory.xml $(wildcard %Optional.xml)
   generation-script $< $*

The files XXXGenerated.c/h are being regenerated when I change XXXCompulsory.xml but not when I change XXXOptional.xml. Does anyone know why?

I can get around the problem with duplicate rules as follows:

%Generated.c %Generated.h : %Compulsory.xml
   generation-script $< $*

%Generated.c %Generated.h : %Compulsory.xml %Optional.xml
   generation-script $< $*

but I would have thought there was a better way to specify an optional dependency?

Thanks!

Note: This same question has been asked before (e.g. How to manage C header file dependencies? ) but in this case I can't have the compiler generate a .d file.

Edit: The location for Optional.xml is fine because it works if I specify only the rule:

%Generated.c %Generated.h : %Compulsory.xml %Optional.xml
   generation-script $< $*

And try to compile only for a target which Optional.xml exists.

But I've noticed that doesn't work with the parenthesis:

%Generated.c %Generated.h : %Compulsory.xml $(%Optional.xml)
   generation-script $< $*
added 411 characters in body
Source Link
austinmarton
  • 2.4k
  • 3
  • 20
  • 23

I have some .c and .h files that are generated by a script based on one XML file and optionally another XML file.

From what I've read I should be able to use a wildcard, for example:

%Generated.c %Generated.h : %Compulsory.xml $(wildcard %Optional.xml)
   generation-script $< $*

The files XXXGenerated.c/h are being regenerated when I change XXXCompulsory.xml but not when I change XXXOptional.xml. Does anyone know why?

I can get around the problem with duplicate rules as follows:

%Generated.c %Generated.h : %Compulsory.xml
   generation-script $< $*

%Generated.c %Generated.h : %Compulsory.xml %Optional.xml
   generation-script $< $*

but I would have thought there was a better way to specify an optional dependency?

Thanks!

Note: This same question has been asked before (e.g. How to manage C header file dependencies? ) but in this case I can't have the compiler generate a .d file.

Edit: The location for Optional.xml is fine because it works if I specify only the rule:

%Generated.c %Generated.h : %Compulsory.xml %Optional.xml
   generation-script $< $*

And try to compile only for a target which Optional.xml exists.

But I've noticed that doesn't work with the parenthesis:

%Generated.c %Generated.h : %Compulsory.xml $(%Optional.xml)
   generation-script $< $*

I have some .c and .h files that are generated by a script based on one XML file and optionally another XML file.

From what I've read I should be able to use a wildcard, for example:

%Generated.c %Generated.h : %Compulsory.xml $(wildcard %Optional.xml)
   generation-script $< $*

The files XXXGenerated.c/h are being regenerated when I change XXXCompulsory.xml but not when I change XXXOptional.xml. Does anyone know why?

I can get around the problem with duplicate rules as follows:

%Generated.c %Generated.h : %Compulsory.xml
   generation-script $< $*

%Generated.c %Generated.h : %Compulsory.xml %Optional.xml
   generation-script $< $*

but I would have thought there was a better way to specify an optional dependency?

Thanks!

Note: This same question has been asked before (e.g. How to manage C header file dependencies? ) but in this case I can't have the compiler generate a .d file.

I have some .c and .h files that are generated by a script based on one XML file and optionally another XML file.

From what I've read I should be able to use a wildcard, for example:

%Generated.c %Generated.h : %Compulsory.xml $(wildcard %Optional.xml)
   generation-script $< $*

The files XXXGenerated.c/h are being regenerated when I change XXXCompulsory.xml but not when I change XXXOptional.xml. Does anyone know why?

I can get around the problem with duplicate rules as follows:

%Generated.c %Generated.h : %Compulsory.xml
   generation-script $< $*

%Generated.c %Generated.h : %Compulsory.xml %Optional.xml
   generation-script $< $*

but I would have thought there was a better way to specify an optional dependency?

Thanks!

Note: This same question has been asked before (e.g. How to manage C header file dependencies? ) but in this case I can't have the compiler generate a .d file.

Edit: The location for Optional.xml is fine because it works if I specify only the rule:

%Generated.c %Generated.h : %Compulsory.xml %Optional.xml
   generation-script $< $*

And try to compile only for a target which Optional.xml exists.

But I've noticed that doesn't work with the parenthesis:

%Generated.c %Generated.h : %Compulsory.xml $(%Optional.xml)
   generation-script $< $*
added 16 characters in body
Source Link
austinmarton
  • 2.4k
  • 3
  • 20
  • 23

I have some .c and .h files that are generated by a script based on one XML file and optionally another XML file.

From what I've read I should be able to use a wildcard, for example:

%Generated.c %Generated.h : %Compulsory.xml $(wildcard %Optional.xml)
   generation-script $< $*

The files XXXGenerated.c/h are being regenerated when I change XXXCompulsory.xml but not when I change XXXOptional.xml. Does anyone know why?

I can get around the problem with duplicate rules as follows:

%Generated.c %Generated.h : %Compulsory.xml
   generation-script $< $*

%Generated.c %Generated.h : %Compulsory.xml %Optional.xml
   generation-script $< $*

but I would have thought there was a better way to specify an optional dependency?

Thanks!

Note: This same question has been asked before (e.g. How to manage C header file dependencies? ) but in this case I can't have the compiler generate a .d file.

I have some .c and .h files that are generated by a script based on one XML file and optionally another XML file.

From what I've read I should be able to use a wildcard, for example:

%Generated.c %Generated.h : %Compulsory.xml $(wildcard %Optional.xml)
   generation-script

The files XXXGenerated.c/h are being regenerated when I change XXXCompulsory.xml but not when I change XXXOptional.xml. Does anyone know why?

I can get around the problem with duplicate rules as follows:

%Generated.c %Generated.h : %Compulsory.xml
   generation-script

%Generated.c %Generated.h : %Compulsory.xml %Optional.xml
   generation-script

but I would have thought there was a better way to specify an optional dependency?

Thanks!

Note: This same question has been asked before (e.g. How to manage C header file dependencies? ) but in this case I can't have the compiler generate a .d file.

I have some .c and .h files that are generated by a script based on one XML file and optionally another XML file.

From what I've read I should be able to use a wildcard, for example:

%Generated.c %Generated.h : %Compulsory.xml $(wildcard %Optional.xml)
   generation-script $< $*

The files XXXGenerated.c/h are being regenerated when I change XXXCompulsory.xml but not when I change XXXOptional.xml. Does anyone know why?

I can get around the problem with duplicate rules as follows:

%Generated.c %Generated.h : %Compulsory.xml
   generation-script $< $*

%Generated.c %Generated.h : %Compulsory.xml %Optional.xml
   generation-script $< $*

but I would have thought there was a better way to specify an optional dependency?

Thanks!

Note: This same question has been asked before (e.g. How to manage C header file dependencies? ) but in this case I can't have the compiler generate a .d file.

Source Link
austinmarton
  • 2.4k
  • 3
  • 20
  • 23
Loading