Makefile中的-C和M=解析

转载地址:https://www.aliyun.com/jiaocheng/144874.html

当make的目标为all时,-C $(KDIR) 指明跳转到内核源码目录下读取那里的Makefile;

M=$(PWD) 表明然后返回到当前目录继续读入、执行当前的Makefile。

例如:

make -C /lib/modules/3.16.0-30-generic/build M=/home/shawn/fly/tmp

make[1]: 正在进入目录 `/usr/src/linux-headers-3.16.0-30-generic'

LD /home/shawn/fly/tmp/built-in.o

CC [M] /home/shawn/fly/tmp/helloworld.o

Building modules, stage 2.

MODPOST 1 modules

CC /home/shawn/fly/tmp/helloworld.mod.o

LD [M] /home/shawn/fly/tmp/helloworld.ko

make[1]:正在离开目录 `/usr/src/linux-headers-3.16.0-30-generic'

root@4a39b502e13d:/nvmp_source_dir/sdk/soc/ssc30x/mpp/ssc308/interface# make gcc -v Using built-in specs. COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/5/lto-wrapper Target: x86_64-linux-gnu Configured with: ../src/configure -v --with-pkgversion='Ubuntu 5.4.0-6ubuntu1~16.04.12' --with-bugurl=file:///usr/share/doc/gcc-5/README.Bugs --enable-languages=c,ada,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-5 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-libmpx --enable-plugin --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-5-amd64/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-5-amd64 --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-5-amd64 --with-arch-directory=amd64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --enable-objc-gc --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu Thread model: posix gcc version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.12) make -C /nvmp_source_dir/sdk/soc/ssc30x/linux-5.10.117 M=/nvmp_source_dir/sdk/soc/ssc30x/mpp/ssc308/interface modules make[1]: Entering directory '/nvmp_source_dir/sdk/soc/ssc30x/linux-5.10.117' make[2]: Entering directory '/nvmp_source_dir/sdk/soc/ssc30x/linux-5.10.117' CC [M] /nvmp_source_dir/sdk/soc/ssc30x/mpp/ssc308/interface/tp_rc.o cc1: error: plugin support is disabled; configure with --enable-plugin cc1: error: plugin support is disabled; configure with --enable-plugin cc1: error: plugin support is disabled; configure with --enable-plugin cc1: error: unrecognized command line option '-Wno-typedef-redefinition' [-Werror] cc1: all warnings being treated as errors scripts/Makefile.build:273: recipe for target '/nvmp_source_dir/sdk/soc/ssc30x/mpp/ssc308/interface/tp_rc.o' failed make[3]: *** [/nvmp_source_dir/sdk/soc/ssc30x/mpp/ssc308/interface/tp_rc.o] Error 1 Makefile:2030: recipe for target '/nvmp_source_dir/sdk/soc/ssc30x/mpp/ssc308/interface' failed make[2]: *** [/nvmp_source_dir/sdk/soc/ssc30x/mpp/ssc308/interface] Error 2 make[2]: Leaving directory '/nvmp_source_dir/sdk/soc/ssc30x/linux-5.10.117' makefile:22: recipe for target 'modules' failed make[1]: *** [modules] Error 2 make[1]: Leaving directory '/nvmp_source_dir/sdk/soc/ssc30x/linux-5.10.117' Makefile:27: recipe for target 'all' failed make: *** [all] Error 2 gcc -v显示--enable-plugin,为什么还会报错呢?
03-13
"D:\Microchip\xc8\v2.40\bin\xc8-cc.exe" -mcpu=16F18854 -Wl,-Map=dist/default/production/NTC_20Channel.X.production.map -DXPRJ_default=default -Wl,--defsym=__MPLAB_BUILD=1 -mdfp="D:/Microchip/MPLABX/v6.00/packs/Microchip/PIC16F1xxxx_DFP/1.9.163/xc8" -fno-short-double -fno-short-float -O0 -fasmfile -maddrqual=ignore -xassembler-with-cpp -mwarn=-3 -Wa,-a -msummary=-psect,-class,+mem,-hex,-file -ginhx32 -Wl,--data-init -mno-keep-startup -mno-osccal -mno-resetbits -mno-save-resetbits -mno-download -mno-stackcall -mdefault-config-bits -std=c99 -gdwarf-3 -mstack=compiled:auto:auto -Wl,--memorysummary,dist/default/production/memoryfile.xml -o dist/default/production/NTC_20Channel.X.production.elf build/default/production/main.p1 main.c:25:: error: (1363) unknown configuration setting/register (BBSIZE = BB512) used main.c:26:: error: (1363) unknown configuration setting/register (BBEN = OFF) used main.c:27:: error: (1363) unknown configuration setting/register (SAFEN = OFF) used main.c:28:: error: (1363) unknown configuration setting/register (WRTAPP = OFF) used main.c:29:: error: (1363) unknown configuration setting/register (WRTB = OFF) used main.c:30:: error: (1363) unknown configuration setting/register (WRTC = OFF) used main.c:31:: error: (1363) unknown configuration setting/register (WRTSAF = OFF) used (908) exit status = 1 nbproject/Makefile-default.mk:138: recipe for target 'dist/default/production/NTC_20Channel.X.production.hex' failed make[2]: Leaving directory 'C:/Users/MJY/Desktop/MPLAB/NTC_20Channel.X' nbproject/Makefile-default.mk:91: recipe for target '.build-conf' failed make[1]: Leaving directory 'C:/Users/MJY/Desktop/MPLAB/NTC_20Channel.X' nbproject/Makefile-impl.mk:39: recipe for target '.build-impl' failed
最新发布
11-05
模块一般用来支持那些不经常使用的功能。例如,通常情况下你仅使用拨号网络,因此网络功能并不是任何时候都需要的,那么就应该使用可装入的模块来提供这个功能。仅在你进行拨号联接的时候,该模块才被装入。而在你断掉连接的时候它会被自动卸下。这样会使内核使用内存的量最小,减小系统的负荷。 当然,那些象硬盘访问这样时时刻刻都需要的功能,则必须作在内核里。如果你搭一台网络工作站或 web服务器,那么网络功能是时刻都需要的,你就应该考虑把网络功能编译到内核里。另外一个方法是在启动的时候就装入网络模块。这种方法的优点是你不需要重新编译内核。而缺点是网络功能不能特别高效。 按照以上的原则,我们首先列出一张清单,看看 kernel 中哪些选项是非有不可的,也就是说,这些东西是必须被编译到内核中的。将那些非必需的模块剔除到内核以外。 第一个是root所在的硬盘配置。 哪果您的硬盘是IDE接口,就把 ide 的选项标记下来。如果是SCSI接口,请把您的接口参数及 SCSI id 记标下来。 第二个是选择使用哪一个文件系统。 Linux的默认文件系统是是 ext2 ,那么就一定要把它标记下来。如果机器中还其它的操作系统,如win98或windows NT,您还会可能选择FAT32或NTFS的支持,不过后面你可以通过手工加载的方式来加入新的模块支持。 第三个是选择Linux所支持的可执行文件格式。这里有两种格式可供选择: elf:这是当前Linux普遍支持的可执行文件格式,必须编译到内核中 。 a.out: 这是旧版的Linux的可执行文件各函数库的格式,如果你确认肯定用不到这种格式的可执行文件,那么就可以不把它编译到内核当中。 以上这些内容,是必须要编译到内核中的。其它的内容凡是所有选项中m提示的,都选择m,这样可以通过手工的方式添加该模块。 ** Loadable module support*Enable loadable module support (CONFIG_MODULES) [Y/n/?]Set version information on all symbols for modules (CONFIG_MODVERSIONS) [N/y/?]Kernel daemon support (e.g. autoload of modules) (CONFIG_KERNELD) [Y/n/?] 分别回答 Y,N,Y 。其中 CONFIG_KERNELD 的 default 值是 N, 所以要注意选择Y。 make config 完后,仍旧是 make dep; make clean。 接下来要 make zlilo 或 make zImage。 然后 make modules ; make modules_install 。完成之后,就编译出一个没有调入多余模块的一个“干净的”内核映像文件了。
Using built-in specs. COLLECT_GCC=arm-none-eabi-gcc COLLECT_LTO_WRAPPER=/usr/lib/gcc/arm-none-eabi/10.3.1/lto-wrapper Target: arm-none-eabi Configured with: ../configure --build=x86_64-linux-gnu --prefix=/usr --includedir='/usr/lib/include' --mandir='/usr/lib/share/man' --infodir='/usr/lib/share/info' --sysconfdir=/etc --localstatedir=/var --disable-option-checking --disable-silent-rules --libdir='/usr/lib/lib/x86_64-linux-gnu' --libexecdir='/usr/lib/lib/x86_64-linux-gnu' --disable-maintainer-mode --disable-dependency-tracking --mandir=/usr/share/man --enable-languages=c,c++,lto --enable-multilib --disable-decimal-float --disable-libffi --disable-libgomp --disable-libmudflap --disable-libquadmath --disable-libssp --disable-libstdcxx-pch --disable-nls --disable-shared --disable-threads --enable-tls --build=x86_64-linux-gnu --target=arm-none-eabi --with-system-zlib --with-gnu-as --with-gnu-ld --with-pkgversion=15:10.3-2021.07-4 --without-included-gettext --prefix=/usr/lib --infodir=/usr/share/doc/gcc-arm-none-eabi/info --htmldir=/usr/share/doc/gcc-arm-none-eabi/html --pdfdir=/usr/share/doc/gcc-arm-none-eabi/pdf --bindir=/usr/bin --libexecdir=/usr/lib --libdir=/usr/lib --disable-libstdc++-v3 --host=x86_64-linux-gnu --with-headers=no --without-newlib --with-multilib-list=rmprofile,aprofile CFLAGS='-g -O2 -ffile-prefix-map=/build/gcc-arm-none-eabi-hYfgK4/gcc-arm-none-eabi-10.3-2021.07=. -flto=auto -ffat-lto-objects -fstack-protector-strong' CPPFLAGS='-Wdate-time -D_FORTIFY_SOURCE=2' CXXFLAGS='-g -O2 -ffile-prefix-map=/build/gcc-arm-none-eabi-hYfgK4/gcc-arm-none-eabi-10.3-2021.07=. -flto=auto -ffat-lto-objects -fstack-protector-strong' DFLAGS=-frelease FCFLAGS='-g -O2 -ffile-prefix-map=/build/gcc-arm-none-eabi-hYfgK4/gcc-arm-none-eabi-10.3-2021.07=. -flto=auto -ffat-lto-objects -fstack-protector-strong' FFLAGS='-g -O2 -ffile-prefix-map=/build/gcc-arm-none-eabi-hYfgK4/gcc-arm-none-eabi-10.3-2021.07=. -flto=auto -ffat-lto-objects -fstack-protector-strong' GCJFLAGS='-g -O2 -ffile-prefix-map=/build/gcc-arm-none-eabi-hYfgK4/gcc-arm-none-eabi-10.3-2021.07=. -fstack-protector-strong' LDFLAGS='-Wl,-Bsymbolic-functions -flto=auto -Wl,-z,relro' OBJCFLAGS='-g -O2 -ffile-prefix-map=/build/gcc-arm-none-eabi-hYfgK4/gcc-arm-none-eabi-10.3-2021.07=. -flto=auto -ffat-lto-objects -fstack-protector-strong' OBJCXXFLAGS='-g -O2 -ffile-prefix-map=/build/gcc-arm-none-eabi-hYfgK4/gcc-arm-none-eabi-10.3-2021.07=. -flto=auto -ffat-lto-objects -fstack-protector-strong' INHIBIT_LIBC_CFLAGS=-DUSE_TM_CLONE_REGISTRY=0 AR_FOR_TARGET=arm-none-eabi-ar AS_FOR_TARGET=arm-none-eabi-as LD_FOR_TARGET=arm-none-eabi-ld NM_FOR_TARGET=arm-none-eabi-nm OBJDUMP_FOR_TARGET=arm-none-eabi-objdump RANLIB_FOR_TARGET=arm-none-eabi-ranlib READELF_FOR_TARGET=arm-none-eabi-readelf STRIP_FOR_TARGET=arm-none-eabi-strip SED=/bin/sed SHELL=/bin/sh BASH=/bin/bash CONFIG_SHELL=/bin/bash Thread model: single Supported LTO compression algorithms: zlib gcc version 10.3.1 20210621 (release) (15:10.3-2021.07-4)
09-29
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值