OpenWrt Forum Archive

Topic: Problem with a simple makefile

The content of this topic has been archived on 31 Mar 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

Hi all,
I'm having a boring problem with this Makefile :

#
# Copyright (C) 2008 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
# $Id$

include $(TOPDIR)/rules.mk

PKG_NAME:=helloworld
PKG_RELEASE:=1
PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)

include $(INCLUDE_DIR)/package.mk

define Package/helloworld
 SECTION:=utils
 CATEGORY:=Utilities
 TITLE:=Helloworld -- prints a snarky message  
endef

define Build/Prepare
    mkdir -p $(PKG_BUILD_DIR)
    $(CP) ./src/* $(PKG_BUILD_DIR)/
endef

define Build/Configure
endef

define Build/Compile
     $(MAKE) -C $(PKG_BUILD_DIR) $(TARGET_CONFIGURE_OPTS)
endef

define Package/helloworld/install
     $(INSTALL_DIR) $(1)/bin
     $(INSTALL_BIN) $(PKG_BUILD_DIR)/helloworld $(1)/bin/
endef

$(eval $(call BuildPackage,helloworld))

When i do "make V=99" in the shell to build my package in OpenWRT,i get this error:

make[3]: Entering directory `/home/vittorio/Scrivania/SRC_WRT/8.09/package/helloworld'
Makefile:40: *** missing separator.  Stop.

Line 40 its the last one of my Makefile..i've checked other makefiles and it seems that mine looks fine..i dont understand where is my error sad.

Regards

i can't see anything wrong, but on the TITLE , remove the -- prints a snarky message   and see if it works

Nothing changed sad..I will try to delete and rewrite down the Makefile even if I don't think that it could be useful..

anyway, here's a makefile i made, compare it to yours even though yours seems perfectly correct

#
# Copyright (C) 2007-2009 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
# $Id: Makefile 16725 2009-07-07 01:10:03Z nico $

include $(TOPDIR)/rules.mk

PKG_NAME:=asterisk-gui
PKG_VERSION:=svn
PKG_RELEASE:=1.0

PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tgz
PKG_SOURCE_URL:=http://downloads.digium.com/pub/telephony/asterisk-gui/releases
PKG_MD5SUM:=524afba7ea4139bde73274f172ae5a01

include $(INCLUDE_DIR)/package.mk



define Package/asterisk-gui
  SECTION:=admin
  CATEGORY:=Administration
  TITLE:=Asterisk GUI
  DEPENDS:= +asterisk14
  VERSION:=$(PKG_VERSION)
endef

define Package/asterisk-gui/description
Asterisk GUI for Asterisk 1.4@OpenWRT
endef


EXTRA_CFLAGS:= $(TARGET_CPPFLAGS)
EXTRA_LDFLAGS:= $(TARGET_LDFLAGS)

define Build/Configure
    ( cd $(PKG_BUILD_DIR); ./bootstrap.sh )
    ( cd $(PKG_BUILD_DIR); ./configure --localstatedir="$(PKG_INSTALL_DIR)/usr" --sysconfdir="$(PKG_INSTALL_DIR)/etc" )
endef

define Build/Compile
    $(MAKE) -C $(PKG_BUILD_DIR) install
endef

define Package/asterisk-gui/install
    $(CP) $(PKG_INSTALL_DIR)/* $(1)
    $(CP) ./files/* $(1)/
endef



$(eval $(call BuildPackage,asterisk-gui))
Vittorio wrote:

Makefile:40: *** missing separator.  Stop.

This error almost always indicates that you used leading spaces in a place where a tab was expected.

~ JoW

Yeah I know that,but i ve checked that in the last line of the code :

$(eval $(call BuildPackage,helloworld))

There isn't any need to use tab space..infact in the other Makefiles it's used spacebar to separate words(in this kind of expressions).I'm not an expert programmer so if u think that tab it's needed tell me where should I put it ^^

(Last edited by Vittorio on 22 Jan 2010, 18:18)

For example

define Package/asterisk-gui
  SECTION:=admin
  CATEGORY:=Administration
  TITLE:=Asterisk GUI
  DEPENDS:= +asterisk14
  VERSION:=$(PKG_VERSION)
endef

should be something like:

define Package/asterisk-gui
    SECTION:=admin
    CATEGORY:=Administration
    TITLE:=Asterisk GUI
    DEPENDS:= +asterisk14
    VERSION:=$(PKG_VERSION)
endef

notice the difference from space to tab?

Yes I've noticed it,I've used tabs where needed and also controlled that my editor doesn't convert tabs into spaces..but nothing changed sig..

i'll check that makefile when i get home, because... i really can't find anything wrong, i'll post back in 2 hours or something

Ok now it works!I've added a blank line at the end of the Makefile..but I really dont know the real reason why that solution solved the problem ^^!

Many thanks to all of you that helped me!

Best regards

wow, that's very weird, but glad you made it big_smile

The discussion might have continued from here.