06mkfile-03tree
来源:互联网 发布:去除ghost预装软件 编辑:程序博客网 时间:2024/06/07 18:34
include/func_a.h
void func_a();
include/func_b.h
void func_b);
lib/func_a.c
#include <stdio.h>#include "func_a.h"void func_a(){ printf("%s\n", __FUNCTION__);}
lib/func_b.c
#include <stdio.h>#include "func_b.h"void func_b(){ printf("%s\n", __FUNCTION__);}~
lib/Makefile
SRCS := func_a.c func_b.c$(BUILT_IN): $(SRCS:.c=.o) $(LD) $(LDFLAGS) -r -o $@ $^$(SRCS:.c=.o): $(CC) $(CFLAGS) -c $<$(DEP): $(SRCS) $(CC) $(CFLAGS) -MM $(SRCS) >$@ sed -i "s/: / $@: /g" $@sinclude $(DEP).PHONY: cleanclean: $(RM) $(SRCS:.c=.o) $(BUILT_IN) $(DEP)~
main/main.c
#include <stdio.h>#include "func_a.h"#include "func_b.h"int main(){ func_a(); func_b(); return 0;}
main/Makefile
SRCS := main.c$(BUILT_IN): $(SRCS:.c=.o) $(LD) $(LDFLAGS) -r -o $@ $^$(SRCS:.c=.o): $(CC) $(CFLAGS) -c $<$(DEP): $(SRCS) $(CC) $(CFLAGS) -MM $(SRCS) >$@ sed -i "s/: / $@: /g" $@sinclude $(DEP).PHONY: cleanclean: $(RM) $(SRCS:.c=.o) $(BUILT_IN) $(DEP)
Makefile
TGT := helloSUBDIR := \ lib \ mainexport TOPDIR := $(shell pwd)export CFLAGS := -O2 -I$(TOPDIR)/includeexport LDFLAGS := export CROSS_COMPILER_PREFIX := export CC := $(CROSS_COMPILER_PREFIX)gccexport LD := $(CROSS_COMPILER_PREFIX)ldexport BUILT_IN := built_in.oexport DEP = dep export MAKE := makeall: $(TGT)$(TGT): $(SUBDIR) $(CC) $(LDFLAGS) -o $@ $(^:=/$(BUILT_IN))$(SUBDIR): $(MAKE) -C $@.PHONY: $(SUBDIR) clean all clean: for dir in $(SUBDIR); do \ $(MAKE) -C $$dir clean; \ done $(RM) $(TGT)~
- 06mkfile-03tree
- 06mkfile-01tst
- 06mkfile-02singledir
- 07mkfile
- linux编译程序注意及简要mkfile
- 嵌入式学习9(Linux gcc gdb mkfile)
- Tree
- tree
- tree
- TREE
- Tree
- Tree
- tree
- tree
- tree
- tree
- tree
- tree
- x86机器(VMware安装Linux系统)启动日志、日志分析、故障分析
- 主机硬件问题导致rac节点重启
- 按键扫描
- C++语言 实现类对象的单模式创建
- 图像处理代码
- 06mkfile-03tree
- C++语言 对话框程序设计
- 栈 Stack
- C++中的常用修饰符inline
- 未捕捉的异常
- poj 2299 求逆序数 树状数组入门
- debian linux android ndk compile env setup
- VBA连接数据库
- oracle视图的curd