Created
September 28, 2019 00:27
-
-
Save pwwang/59bb3a790d96aca397d9ae1c472f3161 to your computer and use it in GitHub Desktop.
A proxy Makefile to subdirectory's Makefile
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# get all targets from subdirectory | |
SUBDIR := subdir | |
TARGETS := $(shell make -C $(SUBDIR) -rpn | sed -n -e "/^$$/ { n ; /^[^ .\#%][^ ]\*:/ { s/:.\*$$// ; p ; } ; }" ) | |
# default target | |
all: | |
# pass all targets to subdirectory | |
%: | |
make -C $(SUBDIR) $@ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Suppose you have a subdirectory
subdir
under current, then anymake
command you do is just like you do it undersubdir
For example:
make
is the same asmake -C subdir
make clean
is the same asmake -C subdir clean
Same for other targets