Makefile 重複定義 target - Linux

Table of Contents

如果我有兩個 Makefile
~/test/Makefile
~/test/subdir/Makefile

在 ~/test/Makefile 定義了 hello 這個 target,
而 ~/test/subdir/Makefile 裡有 include ~/test/Makefile

我希望能在 ~/test/subdir/ 底下 make hello 能在原本內容指令之前和之後,
多作一個指令,但是不能修改 ~/test/Makefile 的內容,
又不把上層的指令整個複製過來,~/test/subdir/Makefile 該怎寫呢?

範例:
~/test/Makefile 內容如下:
hello:
@echo "hello here"

~/test/subdir/Makefile 內容如下:
include ../Makefile

hello:
這邊該怎寫?


要怎寫才能在 ~/test/subdir/ 底下 make hello 能秀出:
say hello
hello here
bye bye




--

All Comments