1. 程式人生 > >makefile 呼叫其他makefile檔案

makefile 呼叫其他makefile檔案

|-- Makefile
|-- test1
||-- Makefile
||-- bin
||   `-- test
||-- hello.o
||-- include
||   `-- hello.h
|   `-- src
|       `-- hello.c
`
-- test2
    
|-- Makefile
    
|-- bin
    
|   `-- test
    
|-- hello.o
    
|-- include
    
|   `-- hello.h
    
|-- obj
    `
-- src
        `
-- hello.c
 根目錄下的Makefile檔案呼叫test2中的Makefile檔案:
根目錄下的Makefile檔案
SUBDIR = ./test2
MAKE 
= make
subsystem:
        cd $(SUBDIR) 
&& $(MAKE)
test2中的Makefile檔案:
all: ./bin/test

CC 
= gcc
INCLUDE 
= ./include
vpath 
%.c ./src
vpath 
%.h ./include

.
/bin/test: hello.o
        $(CC) 
-[email protected] $^
hello.o: hello.c hello.h
        $(CC) 
-c $<-I$(INCLUDE)
.PHONY: clean
clean:
        
-rm *.o
 

相關推薦

makefile 呼叫其他makefile檔案

|-- Makefile|-- test1||-- Makefile||-- bin||   `-- test||-- hello.o||-- include||   `-- hello.h|   `-- src|       `-- hello.c`-- test2   

c語言多檔案程式設計,即main檔案呼叫其他.c檔案的方法

c語言多檔案程式設計,即main檔案呼叫其他.c檔案的方法。 兩種方法的區別就是,gcc編譯時,是否加b.c檔案,不加的話,就在a.c檔案裡面,加#include "b.c" 至於extern 那一句,是否新增,編譯都是可以通過的,只是填加上去,大家都知道了,這個函式在其他地方定義了,這個地方只是呼

python檔案中的__name__=='__main__'的使用及呼叫其他py檔案中的函式方法

最近學習python的時候經常會看到好多py檔案中都有if _name_ == ‘_main_‘: 這句話,所以就花點兒時間來研究一下,總結了一下使用方法及原則。 平時我們使用python IDE編寫py程式的時候 一般是很少用到if name == ‘mai

Pycharm中.py檔案呼叫其他.py檔案的函式

在同一個PycharmProject下,如圖untitled4工程下spyder.py函式中有變數url和函式download():要在lxml.py中呼叫,只需加入import spyter語句,即可呼叫:

makefile呼叫makefile和 objs用法

一、呼叫子目錄Makefile         Makefile只負責編譯當前目錄中的物件。         子目錄中的物件,由子目錄中的Makefile負責。         如何讓make呼叫子目錄中的Makefile?答案是把子目錄包含到obj-y或obj-m中。  

python檔案呼叫其他.py檔案的函式

在寫程式碼的時候,我們要面臨的將程式碼清晰化,主檔案的函式較為簡潔,於是我們便要掌握如何呼叫其他.py檔案的程式碼。 如果A.py檔案與B.py檔案在同一個資料夾下:(A.py呼叫B.py的函式或者類) B.py的函式: def add(x,y): z=x+y

android.mk 詳解 其他makefile檔案類似

關於libs資料夾和obj資料夾 obj下的是帶符號和除錯資訊的,所以就大很多,靜態庫也在這個裡面。lib下的是就去去掉這些龐大資訊後的庫檔案,而且是動態連結的庫。 方便在Android.mk中定義自己的變數,我們建議使用MY_字首 一、單個android.mk檔案

makefile生成 *.d 依賴檔案及 gcc -M -MF -MP 等相關選項說明

1. 為什麼要使用字尾名為 .d 的依賴檔案? 在 Makefile 中, 我們的依賴關係可能需要包含一系列的標頭檔案。  比如  main.c 原始檔內容如下: #include "stdio.h" #include "defs.h" int main(int a

make之makefile 十 函式庫檔案

一、簡單的靜態庫書寫編譯和測試 檔案目錄如下所示: . ├── Makefile ├── MakefileTest ├── include.c ├── include.h └── main.c 0 directories, 5 files 其中main.c函式裡面會呼叫includ

使用Makefile連結so庫檔案

分享一下我老師大神的人工智慧教程!零基礎,通俗易懂!http://blog.csdn.net/jiangjunshow 也歡迎大家轉載本篇文章。分享知識,造福人民,實現我們中華民族偉大復興!        

Makefile編譯靜態庫檔案和動態庫檔案

    最近要用到的簽名演算法只給了一堆原始碼沒有給庫檔案,api都不好呼叫,於是嘗試著用Makefile給一堆c原始碼編譯靜態連結庫檔案和動態連結庫檔案。 Makefile檔案編輯的相關資料連結: https://www.cnblogs.com/yya

Makefile編譯多個檔案

all:easy_select tcp_select .PHONY:all easy_select:easy_select.c gcc $^ -o [email protected] tcp_select:tcp_select.c g

python 如何在某.py檔案呼叫其他.py內的函式

A.py的檔案需要呼叫B.py檔案內的test函式   同一目錄下: A.py #!/usr/bin/env python # -*- coding: utf-8 -*- def test(): ''' 測試函式 ''' print('測試函式')

Makefile 編譯動態庫檔案及連結動態庫

原文轉自 :http://www.cnblogs.com/ljtknowns/p/5647793.html 檔案目錄結構如下 1 dynamiclibapp.c 2 Makefile 3 comm/inc/apue.h 4 comm/errorhandle.c 5

Makefile自動生成依賴檔案,並自動編譯

因為經常要用到makefile編譯,每次都為標頭檔案的依賴關係頭痛,所以這次費了兩天時間開發了一個通用的makefile,它可以自動生成依賴檔案,並編譯,當然你要按檔案裡面的說明來填充一些中間檔名. 程式碼如下: #自動依賴項(*.d),並編譯生成檔案 #編譯選項 LDF

makefile編譯生成.a檔案(linux靜態庫),並編譯進可執行檔案

檔案列表: 程式碼檔案 /* 下列程式碼儲存到 plus.cpp */ int my_plus(int x,int y) { return x + y; }

jupter 下呼叫其他目錄下檔案及tensorboard視覺化實現

【1】jupyter 呼叫其他目錄下函式操作 import numpy as np import tensorflow as tf dir1 = r"E:\tf_project\練習" import sys sys.path.append(dir1) import tens

makefile 自動生成依賴檔案

gcc  -c -o a.o a.c -Wp, -MD a.d a.d就是生成的依賴檔案 在a.d中 有 a.o:a.c a.h  (以及其他依賴的標頭檔案等) 在makefile中,包含依賴檔案,使用依賴檔案,使用如下: include a.d %.o : %.c$(CC

呼叫js檔案裡的函式報錯onclick is not defined處理方法以及呼叫其他方法

1.對於js中onclick方法的使用寫法,正確如下: getChoice = function (param_index) { $(".charge-btn-group").rem

[Makefile]多目錄Makefile寫法

16px 間隔 ews pro images include 先來 文章 status 最近需要寫一個測試程序,這個測試程序需要集成一些功能,寫在同一個文件看上去很不好,多個文件的Makefile又不是很熟,於是分享下面這篇文章 轉自:http://blog.csdn.ne