开发者

Is it possible to have case insensitive targets with GNU make?

开发者 https://www.devze.com 2023-04-08 08:31 出处:网络
Is it possible to design a makefile so that make program_name produces the same result as make PROGRAM_NAME

Is it possible to design a makefile so that

make program_name

produces the same result as

make PROGRAM_NAME

?

I know I can do the following in the makefile

program_name : PROGRAM_NAME

but I don't know if there is a way to streamline this 开发者_StackOverflow中文版for multiple targets. We have about 50 or so targets.


Crude but effective:

PROGRAM_NAME:
    @echo do something for $@

ANOTHER_TARGET:
    @echo do something else for $@

YET_ANOTHER:
    @echo and something else for $@

% :
    @$(MAKE) `echo $@ | tr [:lower:] [:upper:]`
0

精彩评论

暂无评论...
验证码 换一张
取 消