Created
          February 2, 2013 01:48 
        
      - 
      
- 
        Save wb14123/4695624 to your computer and use it in GitHub Desktop. 
    How Kernel's Makefile Specify Output Directory
  
        
  
    
      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
    
  
  
    
  | ifeq ($(KBUILD_SRC),) | |
| ifeq ("$(origin O)", "command line") | |
| KBUILD_OUTPUT := $(O) | |
| endif | |
| ifneq ($(KBUILD_OUTPUT),) | |
| $(filter-out submake $(CURDIR)/Makefile, $(MAKECMDGOALS)): sub-make | |
| @: | |
| sub-make: | |
| make -C $(KBUILD_OUTPUT) -f /home/wangbin/maketest/Makefile \ | |
| KBUILD_SRC=$(PWD) \ | |
| $(MAKECMDGOALS) | |
| @echo " sub-make KBUILD_OUTPUT: $(KBUILD_OUTPUT)" | |
| skip-makefile := 1 | |
| endif #end KBUILD_OUTPUT | |
| endif #end KBUILD_SRC | |
| ifeq ($(skip-makefile),) | |
| target1: | |
| touch target1 | |
| @echo "target KBUILD_OUTPUT: $(KBUILD_OUTPUT)" | |
| target2: | |
| touch target2 | |
| @echo "target KBUILD_OUTPUT: $(KBUILD_OUTPUT)" | |
| endif | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment