Disable make builtin rules and variables from inside the make file

后端 未结 7 726
隐瞒了意图╮
隐瞒了意图╮ 2020-12-04 17:40

I want to disable builtin rules and variables as per passing the -r and -R options to GNU make, from inside the make file. Other solutions that allow me to do this implicitl

7条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-04 18:01

    You could start the Makefile with a #! and call it something different so people don't try to use make directly:

    #!/usr/bin/make -rRf
    # ...
    

    This will cause horrific problems if GNU make is not the system make. Maybe a wrapper script?

    You can also read $(MAKEFLAGS) and make sure the required flags are present.

提交回复
热议问题