多文件多目录的Makefile文件编写
2011-05-27 17:31
423 查看
文件目录为:
stu_sys
|-- Makefile
|-- include
| |-- other
| | `-- other.h
| |-- student
| | `-- student.h
| |-- student_public.h
| `-- teacher
| `-- teacher.h
|-- src
| |-- Makefile
| |-- lib
| | |-- Makefile
| | |-- other
| | | `-- other.c
| | |-- student
| | | |-- Makefile
| | | `-- student.c
| | `-- teacher
| | `-- teacher.c
| `-- scli
| |-- Makefile
| |-- other
| | |-- Makefile
| | |-- other
| | |-- other.c
| | `-- other.db
| |-- student
| | |-- Makefile
| | |-- student
| | |-- student.c
| | `-- student.db
| `-- teacher
| |-- Makefile
| |-- teacher
| |-- teacher.c
| `-- teacher.db
`-- target
|-- other
| `-- other
|-- student
| `-- student
`-- teacher
`-- teacher
stu_sys目录中的Makefile文件编写为:
STUDENT = /root/xiangm/stu_sys/src/scli/student/student
TEACHER = /root/xiangm/stu_sys/src/scli/teacher/teacher
OTHER = /root/xiangm/stu_sys/src/scli/other/other
STALLS = /root/xiangm/stu_sys/target/student/
STALLT = /root/xiangm/stu_sys/target/teacher/
STALLO = /root/xiangm/stu_sys/target/other/
ALL:
make -C src
install:
cp $(STUDENT) $(STALLS)
cp $(TEACHER) $(STALLT)
cp $(OTHER) $(STALLO)
~
-----------------------------------------------------------------------------------------------------------------------------------
src目录中的Makefile文件编写为:
SUBDIRS = lib scli
SRC:
make -C scli
~
-----------------------------------------------------------------------------------------------------------------------------------
lib文件目录中的Makefile编写为:
SUBDIRS = student teacher other
release:
for I in $(SUBDIRS); do /
make -C $$I; /
done
~----------------------------------------------------------------------------------------------------------------------------
scli 目录中的Makefile文件编写为:
SUBDIRS = student teacher other
SCLI:
for I in ${SUBDIRS}; do /
make -C $$I || exit 1;/
done
~
-----------------------------------------------------------------------------------------------------------------------------
student目录下编写的Makefile文件为:
STUDENTC = /root/xiangm/stu_sys/src/lib/student/student.c
STUDENTH = /root/xiangm/stu_sys/include/
STUDENTH1 = /root/xiangm/stu_sys/include/student
STUDENT:
gcc -o student student.c ${STUDENTC} -I ${STUDENTH} -I ${STUDENTH1}
--------------------------------------------------------------------------------------------------------------------------------
teacher目录下变编写的Makefile文件为:
TEACHERC = /root/xiangm/stu_sys/src/lib/teacher/teacher.c
TEACHERH = /root/xiangm/stu_sys/include/
TEACHERH1 = /root/xiangm/stu_sys/include/teacher
TEACHER:
gcc -o teacher teacher.c ${TEACHERC} -I ${TEACHERH} -I ${TEACHERH1}
-------------------------------------------------------------------------------------------------------------------------------
OTHERC = /root/xiangm/stu_sys/src/lib/other/other.c
OTHERH = /root/xiangm/stu_sys/include
OTHERH1 = /root/xiangm/stu_sys/include/other
OTHER:
gcc -o other other.c ${OTHERC} -I ${OTHERH} -I ${OTHERH1}
转自 http://hi.baidu.com/wangsenlin88/blog/item/95dcb2dcf01a26d68c10293e.html
stu_sys
|-- Makefile
|-- include
| |-- other
| | `-- other.h
| |-- student
| | `-- student.h
| |-- student_public.h
| `-- teacher
| `-- teacher.h
|-- src
| |-- Makefile
| |-- lib
| | |-- Makefile
| | |-- other
| | | `-- other.c
| | |-- student
| | | |-- Makefile
| | | `-- student.c
| | `-- teacher
| | `-- teacher.c
| `-- scli
| |-- Makefile
| |-- other
| | |-- Makefile
| | |-- other
| | |-- other.c
| | `-- other.db
| |-- student
| | |-- Makefile
| | |-- student
| | |-- student.c
| | `-- student.db
| `-- teacher
| |-- Makefile
| |-- teacher
| |-- teacher.c
| `-- teacher.db
`-- target
|-- other
| `-- other
|-- student
| `-- student
`-- teacher
`-- teacher
stu_sys目录中的Makefile文件编写为:
STUDENT = /root/xiangm/stu_sys/src/scli/student/student
TEACHER = /root/xiangm/stu_sys/src/scli/teacher/teacher
OTHER = /root/xiangm/stu_sys/src/scli/other/other
STALLS = /root/xiangm/stu_sys/target/student/
STALLT = /root/xiangm/stu_sys/target/teacher/
STALLO = /root/xiangm/stu_sys/target/other/
ALL:
make -C src
install:
cp $(STUDENT) $(STALLS)
cp $(TEACHER) $(STALLT)
cp $(OTHER) $(STALLO)
~
-----------------------------------------------------------------------------------------------------------------------------------
src目录中的Makefile文件编写为:
SUBDIRS = lib scli
SRC:
make -C scli
~
-----------------------------------------------------------------------------------------------------------------------------------
lib文件目录中的Makefile编写为:
SUBDIRS = student teacher other
release:
for I in $(SUBDIRS); do /
make -C $$I; /
done
~----------------------------------------------------------------------------------------------------------------------------
scli 目录中的Makefile文件编写为:
SUBDIRS = student teacher other
SCLI:
for I in ${SUBDIRS}; do /
make -C $$I || exit 1;/
done
~
-----------------------------------------------------------------------------------------------------------------------------
student目录下编写的Makefile文件为:
STUDENTC = /root/xiangm/stu_sys/src/lib/student/student.c
STUDENTH = /root/xiangm/stu_sys/include/
STUDENTH1 = /root/xiangm/stu_sys/include/student
STUDENT:
gcc -o student student.c ${STUDENTC} -I ${STUDENTH} -I ${STUDENTH1}
--------------------------------------------------------------------------------------------------------------------------------
teacher目录下变编写的Makefile文件为:
TEACHERC = /root/xiangm/stu_sys/src/lib/teacher/teacher.c
TEACHERH = /root/xiangm/stu_sys/include/
TEACHERH1 = /root/xiangm/stu_sys/include/teacher
TEACHER:
gcc -o teacher teacher.c ${TEACHERC} -I ${TEACHERH} -I ${TEACHERH1}
-------------------------------------------------------------------------------------------------------------------------------
OTHERC = /root/xiangm/stu_sys/src/lib/other/other.c
OTHERH = /root/xiangm/stu_sys/include
OTHERH1 = /root/xiangm/stu_sys/include/other
OTHER:
gcc -o other other.c ${OTHERC} -I ${OTHERH} -I ${OTHERH1}
转自 http://hi.baidu.com/wangsenlin88/blog/item/95dcb2dcf01a26d68c10293e.html
相关文章推荐
- makefile 进阶--可以用于实际嵌入式工程中的文件编写2目录引入
- 多文件、多目录的Makefile的编写
- 编写多文件,多目录makefile(借鉴网上的一篇文章来自己练手)
- 单目录下多文件 makefile编写
- 单目录下多文件 makefile编写
- 多文件及多目录下MakeFile文件的编写
- 快速编写“专家级”makefile(4.打造更专业的编译环境——支持头文件目录的指定)
- 多层目录编译的makefile文件编写
- 多文件多目录 Makefile文件编写
- 多目录下多文件 makefile编写
- 编写一个程序,将 d:\java 目录下的所有.java 文件复制到 d:\jad 目录下,并将原来文件的扩展名从.java 改为.jad。
- Linux平台Makefile文件的编写基础篇
- makefile文件的编写规则及实例 (转)
- Linux内核源代码顶层目录下的Makefile文件分析一
- 遇到错误-----安装DBD:MySql模块遇到的问题及解决办法Can't exec "mysql_config": 没有那个文件或目录 at Makefile.PL line 479.
- 查找该目录下指定文件类型的用 vc 6.0 编写 的关于文件搜索的例子
- Makefile中的wildcard函数(用来获取指定目录下的文件)
- linux驱动编写(Kconfig文件和Makefile文件)
- 【Linux】makefile文件编写
- makefile 自动编译同一个目录下的所有文件