使用 make clean 命令时出现问题

linuxon 2010-01-08 11:58:13
编译的时候出现了如下错误:
../libplat/b64.d:1***commands commence before first target . stop不知道是什么原因啊,
在网上查了很多,都说是在那一行之前缺个TAB,但是补完事儿,还是出现同样的错误.
b64.d的文件内容如下:
/root/iros/iros-muti-port-onu-3.3.0.0-Oct-23-2008/src/cmn/plat/b64.c \
/root/iros/iros-muti-port-onu-3.3.0.0-Oct-23-2008/libplat/../iros_config.h
前面都加了TAB.
还请大家帮小弟一下.
...全文
923 19 打赏 收藏 转发到动态 举报
写回复
用AI写文章
19 条回复
切换为时间正序
请发表友善的回复…
发表回复
linuxon 2010-01-16
  • 打赏
  • 举报
回复
clean: $(CLEAN_LIST)

$(CLEAN_LIST): force
@if test -f $(patsubst clean-%, %, $@)/makefile.rebuild ; then \
$(MAKE) -C $(patsubst clean-%, %, $@) -f makefile.rebuild clean ; \
elif test -f $(patsubst clean-%, %, $@)/Makefile ; then \
$(MAKE) -i -C $(patsubst clean-%, %, $@) clean ; \
else \
printf "No makefile found in %s\n" $(patsubst clean-%, %, $@) ; \
fi

INSTALL_LIST_TMP=$(patsubst %, install-%, $(TARGET_LIST))
install: $(INSTALL_LIST_TMP)
$(INSTALL_LIST_TMP) : force
@if test -f $(patsubst install-%, %, $@)/makefile.rebuild ; then \
echo Nothing to do ; \
else \
$(MAKE) -i -C $(patsubst install-%, %, $@) install ; \
fi

force:;
linuxon 2010-01-16
  • 打赏
  • 举报
回复
刚才贴了一次没贴好,前面都有 TAB的.
clean: $(CLEAN_LIST)

$(CLEAN_LIST): force
@if test -f $(patsubst clean-%, %, $@)/makefile.rebuild ; then \
$(MAKE) -C $(patsubst clean-%, %, $@) -f makefile.rebuild clean ; \
elif test -f $(patsubst clean-%, %, $@)/Makefile ; then \
$(MAKE) -i -C $(patsubst clean-%, %, $@) clean ; \
else \
printf "No makefile found in %s\n" $(patsubst clean-%, %, $@) ; \
fi

INSTALL_LIST_TMP=$(patsubst %, install-%, $(TARGET_LIST))
install: $(INSTALL_LIST_TMP)
$(INSTALL_LIST_TMP) : force
@if test -f $(patsubst install-%, %, $@)/makefile.rebuild ; then \
echo Nothing to do ; \
else \
$(MAKE) -i -C $(patsubst install-%, %, $@) install ; \
fi

force:;
linuxon 2010-01-16
  • 打赏
  • 举报
回复
这个是那个文件的
clean: $(CLEAN_LIST)

$(CLEAN_LIST): force
@if test -f $(patsubst clean-%, %, $@)/makefile.rebuild ; then \
$(MAKE) -C $(patsubst clean-%, %, $@) -f makefile.rebuild clean ; \
elif test -f $(patsubst clean-%, %, $@)/Makefile ; then \
$(MAKE) -i -C $(patsubst clean-%, %, $@) clean ; \
else \
printf "No makefile found in %s\n" $(patsubst clean-%, %, $@) ; \
fi

INSTALL_LIST_TMP=$(patsubst %, install-%, $(TARGET_LIST))
install: $(INSTALL_LIST_TMP)
$(INSTALL_LIST_TMP) : force
@if test -f $(patsubst install-%, %, $@)/makefile.rebuild ; then \
echo Nothing to do ; \
else \
$(MAKE) -i -C $(patsubst install-%, %, $@) install ; \
fi

force:;

[Quote=引用 13 楼 arong1234 的回复:]
下面这段前面有tab么?贴上来以后看不出来了

$(CLEAN_LIST): force
@if test -f $(patsubst clean-%, %, $@)/makefile.rebuild ; then \
$(MAKE) -C $(patsubst clean-%, %, $@) -f makefile.rebuild clean  ; \
    elif test -f $(patsubst clean-%, %, $@)/Makefile ; then \
    $(MAKE) -i -C $(patsubst clean-%, %, $@) clean ; \
else \
printf "No makefile found in %s\n" $(patsubst clean-%, %, $@)  ; \
fi

[/Quote]
arong1234 2010-01-14
  • 打赏
  • 举报
回复
make clean不是最后一句吧?而是清除现有的文件,已备重新编译,这很可能很重要的
[Quote=引用 14 楼 hitlion2008 的回复:]
通常情况下, make clean都没有太大意义, 它是最后一步, 在它之前都安装差不多了, 所以它出错了也没有事
[/Quote]
xinyaun110 2010-01-14
  • 打赏
  • 举报
回复
你的Makefiel 贴的不全啊?都贴出来
alexhilton 2010-01-13
  • 打赏
  • 举报
回复
通常情况下, make clean都没有太大意义, 它是最后一步, 在它之前都安装差不多了, 所以它出错了也没有事
arong1234 2010-01-13
  • 打赏
  • 举报
回复
下面这段前面有tab么?贴上来以后看不出来了

$(CLEAN_LIST): force
@if test -f $(patsubst clean-%, %, $@)/makefile.rebuild ; then \
$(MAKE) -C $(patsubst clean-%, %, $@) -f makefile.rebuild clean ; \
elif test -f $(patsubst clean-%, %, $@)/Makefile ; then \
$(MAKE) -i -C $(patsubst clean-%, %, $@) clean ; \
else \
printf "No makefile found in %s\n" $(patsubst clean-%, %, $@) ; \
fi
jxxx2967 2010-01-12
  • 打赏
  • 举报
回复
[Quote=引用楼主 linuxon 的回复:]
编译的时候出现了如下错误:
../libplat/b64.d:1***commands commence before first target . stop不知道是什么原因啊,
在网上查了很多,都说是在那一行之前缺个TAB,但是补完事儿,还是出现同样的错误.
b64.d的文件内容如下:
/root/iros/iros-muti-port-onu-3.3.0.0-Oct-23-2008/src/cmn/plat/b64.c \
/root/iros/iros-muti-port-onu-3.3.0.0-Oct-23-2008/libplat/../iros_config.h
前面都加了TAB.
还请大家帮小弟一下.

[/Quote]

我翻译一下,“在第一个目标之前出现了命令”
不是少了TAB,而是多了TAB
linuxon 2010-01-12
  • 打赏
  • 举报
回复
这个文件是libplat目录下包含的那个makefile.rc文件;
#setup for EPON
ifndef SWHOME
$(error SWHOME not defined)
endif
ifndef TOOLSHOME
$(error TOOLSHOME not defined)
endif
ifndef BUILDID
BUILDID=$(shell date +"%s")
#$(warning new BUILDID $(BUILDID))
endif
export GNUTOOLSHOME=$(TOOLSHOME)/gnutools
PATH:=$(GNUTOOLSHOME)/bin:/usr/local/bin:/bin:/usr/bin
PATH:=$(SWHOME)/ecos/ecos-2.1/tools/bin:$(PATH)
PATH:=$(SWHOME)/tools/support/scripts/general:$(PATH)
PATH:=$(SWHOME)/tools/support/tools/bin:$(PATH)
export PATH
export BUILDID
#$(warning BUILDID $(BUILDID))





这个是最后一行中的makefile.mod_start文件
MOD_HOME=$(shell pwd)

# store object files and result in the same place as module source
MOD_TMPHOME=$(MOD_HOME)

# any modular specific stuff are defined here
ifndef MOD_CFLAGS
MOD_CFLAGS=-DSW_DEBUG
endif

MOD_INCLUDES:=-I$(ECOS_INSTALL_HOME)/include \
-I../. \
-I$(SWHOME)/src/include $(MOD_INCLUDES) \
-I$(SWHOME)/src/sc/imst/iros/include \
-I$(SWHOME)/src/sc/imst/include \

ifndef MOD_LDFLAGS
MOD_LDFLAGS=
endif

include $(SWHOME)/tools/support/build/makefile.mod_compile

这个是九楼所说的那个有clean选项的文件:
# File Name : iros/support/build/makefile.start
# Date: 09/14/2002
# Original Author: Henry Zhu
# Desc: this makefile is shared by SW building hierachy to start
# main building steps. It simply takes a list of targets
# which are names of sub-directories under the same directory
# with the user of this makefile.

#TARGET_LIST is a list of sub-directories defined by the user makefile

#CLEAN_LIST=$(patsubst %, clean-%, $(TARGET_LIST))
ifeq ($(firstword $(TARGET_LIST)),iros)
TEMP_CLEAN_LIST=$(wordlist 2,$(words $(TARGET_LIST)), $(TARGET_LIST))
TEMP_CLEAN_LIST+=$(firstword $(TARGET_LIST))
CLEAN_LIST=$(patsubst %, clean-%, $(TEMP_CLEAN_LIST))
else
CLEAN_LIST=$(patsubst %, clean-%, $(TARGET_LIST))
endif

THIS_OS=$(shell uname -s)
export THIS_OS

ifneq ($(THIS_OS), Linux)
$(error Not supported host os $(THIS_OS))
endif

do_this: $(TARGET_LIST)

$(TARGET_LIST): force
@if test -f $@/makefile ; then \
$(MAKE) -C $@ ; \
elif test -f $@/Makefile ; then \
$(MAKE) -C $@ ; \
elif test -f $@/makefile.rebuild ; then \
$(MAKE) -C $@ -f makefile.rebuild ; \
else \
printf "No makefile found in %s\n" $@ ; \
fi

clean: $(CLEAN_LIST)

$(CLEAN_LIST): force
@if test -f $(patsubst clean-%, %, $@)/makefile.rebuild ; then \
$(MAKE) -C $(patsubst clean-%, %, $@) -f makefile.rebuild clean ; \
elif test -f $(patsubst clean-%, %, $@)/Makefile ; then \
$(MAKE) -i -C $(patsubst clean-%, %, $@) clean ; \
else \
printf "No makefile found in %s\n" $(patsubst clean-%, %, $@) ; \
fi

INSTALL_LIST_TMP=$(patsubst %, install-%, $(TARGET_LIST))
install: $(INSTALL_LIST_TMP)
$(INSTALL_LIST_TMP) : force
@if test -f $(patsubst install-%, %, $@)/makefile.rebuild ; then \
echo Nothing to do ; \
else \
$(MAKE) -i -C $(patsubst install-%, %, $@) install ; \
fi

force:;

找到这个几文件了,但是不知道怎么改呀,试了几次都没对









arong1234 2010-01-09
  • 打赏
  • 举报
回复
你说得这些源文件部分其实是不需要tab得,只有处理target得命令前面需要tab
[Quote=引用楼主 linuxon 的回复:]
编译的时候出现了如下错误:
../libplat/b64.d:1***commands commence before first target . stop不知道是什么原因啊,
在网上查了很多,都说是在那一行之前缺个TAB,但是补完事儿,还是出现同样的错误.
b64.d的文件内容如下:
/root/iros/iros-muti-port-onu-3.3.0.0-Oct-23-2008/src/cmn/plat/b64.c \
/root/iros/iros-muti-port-onu-3.3.0.0-Oct-23-2008/libplat/../iros_config.h
前面都加了TAB.
还请大家帮小弟一下.

[/Quote]
arong1234 2010-01-09
  • 打赏
  • 举报
回复
他说得是first target出了问题,你这里没有定义任何target,都在你include那些文件中,找找那里有没有少
尤其要看看clean和clean依赖得target
linuxon 2010-01-09
  • 打赏
  • 举报
回复
这个是../libplat 下的Makefile文件

include ../makefile.rc
MOD_NAME=plat
MOD_TARGET=library
ECOS_INSTALL_HOME=../iros/install
IROS_CONFIG_H=$(shell pwd)/../iros_config.h

MOD_CFLAGS= -Werror -mcpu=arm7tdmi -g -nostdlib -c -fno-inline \
-mthumb-interwork -mthumb -DONU_AAL -DCTC_EXT=1 -DIROS_BIG_BLOB \
-include $(IROS_CONFIG_H)


#$(SWHOME)/src/cmn/plat/flash.c \
#$(SWHOME)/src/cmn/plat/imst_arm_integrator_flash.c\


CFILES= \
$(SWHOME)/src/cmn/plat/b64.c \
$(SWHOME)/src/cmn/plat/eeprom.c \
$(SWHOME)/src/cmn/plat/i2c.c \
$(SWHOME)/src/cmn/plat/mdio.c \
$(SWHOME)/src/cmn/plat/cli.c \
$(SWHOME)/src/cmn/plat/io.c \
$(SWHOME)/src/cmn/plat/iros_cmn.c \
$(SWHOME)/src/cmn/plat/post.c \
$(SWHOME)/src/cmn/plat/system_test_gpio.c \
$(SWHOME)/src/cmn/plat/cpuload.c \
$(SWHOME)/src/cmn/plat/logger.c \
$(SWHOME)/src/cmn/plat/flash_cli.c \
$(SWHOME)/src/cmn/tests/flash/jffs2_1.c \
$(SWHOME)/src/cmn/tests/flash/jffs2_1_1.c \
$(SWHOME)/src/cmn/tests/flash/jffs2_2.c \
$(SWHOME)/src/cmn/tests/flash/jffs2_3.c \
$(SWHOME)/src/cmn/tests/flash/flash1.c \


MOD_INCLUDES=-I$(ECOS_INSTALL_HOME)/include \
-I$(SWHOME)/src/include \
-I$(SWHOME)/src/cmn/apps/clause57 \
-I$(SWHOME)/src/onu/aal \
-I$(SWHOME)/ecos/ecos-2.1/packages/io/flash/current/include

include $(SWHOME)/tools/support/build/makefile.mod_start

aozhi 2010-01-08
  • 打赏
  • 举报
回复
帖make文件
wxgiter 2010-01-08
  • 打赏
  • 举报
回复
帮顶
多试几种情况。
z569362161 2010-01-08
  • 打赏
  • 举报
回复
不知道
jernymy 2010-01-08
  • 打赏
  • 举报
回复
makefile tab很重要
lwd4210 2010-01-08
  • 打赏
  • 举报
回复
转换一下文件格式看看。
云梦谭 2010-01-08
  • 打赏
  • 举报
回复
编辑器是不是把tab展开为空格了?仔细检查一下哪里少了tab
  • 打赏
  • 举报
回复
肯定是make文件里少了个tab,makefile这点很要命。你改完继续看,再报错,肯定还有其他地方没改。

69,371

社区成员

发帖
与我相关
我的任务
社区描述
C语言相关问题讨论
社区管理员
  • C语言
  • 花神庙码农
  • 架构师李肯
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧