前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >不能使用astyle对Linux的Kconfig和Makefile进行排版,会导致编译错误

不能使用astyle对Linux的Kconfig和Makefile进行排版,会导致编译错误

作者头像
hankfu
发布2023-10-16 18:37:16
1520
发布2023-10-16 18:37:16
举报
文章被收录于专栏:hankhank

代码排版工具

不同人代码的排版习惯不一样。遇到自己不喜欢的格式,看起来比较麻烦。可以使用astyle对代码进行排版。 我喜欢以"otbs"格式的排版。命令如下:

代码语言:javascript
复制
astyle -s --style=otbs *.c 
astyle -s --style=otbs *.h

错误排版

一次使用时,不小心对所有文件进行了排版。

代码语言:javascript
复制
hankf@XSZGS4:xilinx$  astyle -s --style=otbs *

hankf@XSZGS4:xilinx$ ls -l -h
total 188K
-rw-rw-r-- 1 hankf hankf 2.1K Jun 20 15:09 Kconfig
-rw-r--r-- 1 hankf hankf 2.1K Jun 16 17:08 Kconfig.orig
-rw-rw-r-- 1 hankf hankf 1.5K Jun 20 14:57 Makefile
-rw-r--r-- 1 hankf hankf  661 Jun 16 17:08 Makefile.orig
-rw-rw-r-- 1 hankf hankf 3.6K Jun 20 14:18 xilinx-dp-card.c
-rw-rw-r-- 1 hankf hankf 4.6K Jun 20 14:18 xilinx-dp-codec.c
-rw-rw-r-- 1 hankf hankf 2.3K Jun 20 14:18 xilinx-dp-pcm.c
-rw-rw-r-- 1 hankf hankf  27K Jun 20 14:52 xlnx_formatter_pcm.c
-rw-rw-r-- 1 hankf hankf 8.1K Jun 20 15:03 xlnx_i2s.c
-rw-rw-r-- 1 hankf hankf  15K Jun 20 14:57 xlnx_pl_snd_card.c
-rw-rw-r-- 1 hankf hankf  15K Jun 20 14:50 xlnx_pl_snd_card.c.orig
-rw-rw-r-- 1 hankf hankf  18K Jun 20 15:04 xlnx_sdi_audio.c
-rw-rw-r-- 1 hankf hankf  383 Jun 20 14:31 xlnx_snd_common.h
-rw-rw-r-- 1 hankf hankf  12K Jun 20 15:05 xlnx_spdif.c

再编译Linux是,得到下列错误。

代码语言:javascript
复制
NOTE: linux-xlnx: compiling from external source tree workspace/linux-xlnx
ERROR: linux-xlnx-5.4+git999-r0 do_compile_kernelmodules: oe_runmake failed
ERROR: linux-xlnx-5.4+git999-r0 do_compile_kernelmodules: Execution of '..../linux-xlnx/5.4+git999-r0/temp/run.do_compile_kernelmodules.3904' failed with exit code 1:
make: Entering directory '..../linux-xlnx/5.4+git999-r0/linux-xlnx-5.4+git999'
  GEN     Makefile
scripts/kconfig/conf  --syncconfig Kconfig
sound/soc/xilinx/Kconfig:13:warning: ignoring unsupported character '.'
sound/soc/xilinx/Kconfig:14: syntax error
sound/soc/xilinx/Kconfig:13: unknown statement "support"
sound/soc/xilinx/Kconfig:14:warning: ignoring unsupported character '.'
sound/soc/xilinx/Kconfig:14: unknown statement "audio"
make[3]: *** [workspace/linux-xlnx/scripts/kconfig/Makefile:73: syncconfig] Error 1
make[2]: *** [workspace/linux-xlnx/Makefile:567: syncconfig] Error 2
make[1]: *** [workspace/linux-xlnx/Makefile:678: include/config/auto.conf.cmd] Error 2
make[1]: *** [include/config/auto.conf.cmd] Deleting file 'include/config/tristate.conf'
make: *** [workspace/linux-xlnx/Makefile:179: sub-make] Error 2
make: Leaving directory '..../linux-xlnx/5.4+git999-r0/linux-xlnx-5.4+git999'

恢复

幸好astyle对文件进行了备份。之间使用 Kconfig.orig、Makefile.orig恢复Kconfig和Makefile。再次编译,又能正常编译了。

代码语言:javascript
复制
hankf@XSZGS4:xilinx$ cp Kconfig.orig  Kconfig

hankf@XSZGS4:xilinx$ cp Makefile.orig  Makefile
本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
原始发表:2023-06-27,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 代码排版工具
  • 错误排版
  • 恢复
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档