makefile 條件判斷用法和 自定函式用法簡單記錄
.PHONY:all clean
common_src= ptp_raw.c
axi_bus_src= axi_bus.c
lib=libfpga.a
axi_obj=$(axi_bus_src:.c=.o)
ptp_src= $(common_src) ptpd.c ptp_timer.c
ptp_obj=$(ptp_src:.c=.o)
lib_src=fpga_axi.c
lib_obj=$(lib_src:.c=.o)
ptp=ptpd
axi_bus=fpga
ifeq ($(CC),cc)
CC := gcc
AR := ar
endif
# ifeq ($(SHELL),/bin/sh)
# SHELL:=/bin/bash
# endif
ifneq ($(SHELL),/bin/bash)
status=no
endif
define test
echo $(1)
endef
all: $(lib) $(ptp) $(axi_bus)
$(lib): $(lib_obj)
ifdef status
$(call test,$(status))
endif
$(AR) -cr $@ $(filter %.o,$^)
$(lib_obj):$(lib_src)
$(CC) -Wall -Werror $(filter %.c,$^) -c
$(ptp):$(ptp_obj)
$(CC) -Wall -Werror -L./ $(filter %.o,$^) -o $@ -lfpga
$(axi_bus):$(axi_obj)
$(CC) -Wall -Werror -L./ $(filter %.o,$^) -lfpga -o $@
.c.o:
$(CC) -Wall -Werror -L./ $(filter %.c,$^) -lfpga -c
tags:
ctags -R
cscope -Rbq
clean:
rm -rf $(axi_bus) $(ptp) $(axi_obj) $(ptp_obj) $(lib) $(lib_obj) tags cscope*
相關文章
- MySQL函式-條件判斷函式MySql函式
- $.ajax()函式用法簡單例項函式單例
- 判斷符合條件記錄是否存在SQL若干SQL
- javascript call()函式用法簡單介紹JavaScript函式
- javascript trim()函式用法簡單介紹JavaScript函式
- getFullYear()函式用法簡單介紹函式
- js isPrototypeOf()函式用法簡單介紹JS函式
- makefile--if條件判斷語句的語法與使用
- jQuery的text()、html()和val()函式用法簡單介紹jQueryHTML函式
- js isNaN函式的用法簡單介紹JSNaN函式
- jQuery的index()函式用法簡單介紹jQueryIndex函式
- js eval()函式的用法簡單介紹JS函式
- js fromCharCode()函式用法簡單介紹JS函式
- PHP 自定義函式用法及常用函式集合PHP函式
- C# Debug和release判斷用法C#
- Makefile和GCC日常用法GC
- Qt5.9中QObject::connect()函式用法(函式使用的前提條件和引數詳解)QTObject函式
- 判斷函式和方法函式
- ascii函式和substr函式的用法ASCII函式
- Sass學習筆記–初步瞭解函式、運算、條件判斷及迴圈筆記函式
- Python assert斷言函式及用法Python函式
- 六、Vue條件判斷Vue
- Grovvy-條件判斷
- Python-split()函式用法及簡單實現Python函式
- javascript陣列的map()函式用法簡單介紹JavaScript陣列函式
- js函式中的if判斷和a==b判斷JS函式
- lisp 裡的條件判斷Lisp
- Shell 條件判斷總結
- Laravel 條件陣列 in 的用法Laravel陣列
- 記錄一種自定義標籤的用法
- 通用函式和條件表示式函式
- Translate函式用法函式
- abs函式用法函式
- 分散式系列七: zookeeper簡單用法分散式
- javascript this用法和簡單例項JavaScript單例
- Sanic response stream() 函式用法和示例函式
- Sanic response redirect() 函式用法和示例函式
- Sanic response raw() 函式用法和示例函式