Makefile:635: *** missing separator (did you mean TAB instead of 8 spaces?). Stop - makefile

I'm trying to create a package, compile it and install it in OpenWrt. However, I have trouble getting past this error:
Makefile:635: *** missing separator (did you mean TAB instead of 8 spaces?). Stop.
Here's the line 635 in Makefile:
define Package/qt4-drivers-gfx-vnc/install
$(INSTALL_DIR) \
$(1)/usr/lib/Qt/plugins/gfxdrivers
$(CP) \
$(PKG_INSTALL_DIR)/usr/lib/Qt/plugins/gfxdrivers/libqgfxvnc.so \
$(1)/usr/lib/Qt/plugins/gfxdrivers/
endef
$(eval $(call BuildPackage,qt4)) /*this is the line 635*/
$(eval $(call BuildPackage,qt4-gui))
$(eval $(call BuildPackage,qt4-demos))
$(eval $(call BuildPackage,qt4-examples))
$(eval $(call BuildPackage,qt4-network))
$(eval $(call BuildPackage,qt4-sqlite))
$(eval $(call BuildPackage,qt4-mysql))
$(eval $(call BuildPackage,qt4-openssl))

Related

Same rule for different directory in makefile

I am having rule like this.
$(OBJDIR)/%.s: %.c
$(CC) $(PPE-CFLAGS) $(DEFS) -S -o $# $<
i have a list like
dirs := $(OBJDIR) $(COMOBJDIR)
So, instead of writing duplicate code for each dir, can I make them into one? Something like iteration on demand?
You have hit one of the weak spots in Make: its inability to handle multiple wildcards at once. There is a way, but it's ugly.
First take your rule:
$(OBJDIR)/%.s: %.c
$(CC) $(PPE-CFLAGS) $(DEFS) -S -o $# $<
and put it into a variable, escaping the '$' symbols and replacing $(OBJDIR) with $(1):
define myrule
$(1)/%.s: %.c
$$(CC) $$(PPE-CFLAGS) $$(DEFS) -S -o $$# $$<
endef
Then you can call it using call and invoke it using eval:
$(eval $(call myrule, $(OBJDIR))
That's good enough for OBJDIR, but to do the same for a list of directories, use foreach:
$(foreach dir, $(OBJDIR) $(COMOBJDIR), $(eval $(call myrule, $(dir))))
Or just use your variable:
dirs := $(OBJDIR) $(COMOBJDIR)
$(foreach dir, $(dirs), $(eval $(call myrule, $(dir))))
Ugly, but effective.

Missing separator in makefile error message

I have project, which should be compiled without a problem, but after setting everything , I get this error message :
Makefile:460: *** missing separator. stops
I've checked the line but didn't get where the error could be , here a snap of the code, in which the issue occures:
# Assemble: create object files from assembler source files.
define ASSEMBLE_TEMPLATE
$(OUTDIR)/$(notdir $(basename $(1))).o : $(1)
## #echo
#echo $(MSG_ASSEMBLING) $$< "->" $$#
$(CC) -c $(THUMB) $$(ASFLAGS) $$< -o $$#
endef # here is the line 460
$(foreach src, $(ASRC), $(eval $(call ASSEMBLE_TEMPLATE, $(src))))
any idea how can I solve this , thanks for any hint

Could OpenWrt run on barebox?

Could OpenWrt run on barebox
Is there a portable application framework on top of uboot/barebox? So my source code is indepent from the low-level hardware.
Absolutely possible. I've been using barebox as a main bootloader for imx25 SoC. There is no barebox in a public packages though(I've never met it), but you can build your own "bootloader-barebox" package.
Just follow these links:
https://vivekian2.wordpress.com/2007/03/28/building-your-own-package-for-openwrt/
http://prplfoundation.org/wiki/Creating_an_OpenWrt_package_for_a_web_page
I'm not sure about framework, but you probably know that you can create an application. http://www.denx.de/wiki/view/DULG/UBootStandalone
Here is an example of Makefile for barebox:
#
# Copyright (C) 2013 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
include $(TOPDIR)/rules.mk
include $(INCLUDE_DIR)/kernel.mk
PKG_NAME:=barebox
PKG_VERSION:=0.1
PKG_RELEASE:=0
PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)
PKG_SOURCE:=$(PKG_NAME).tar.bz2
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=GIT-URL
PKG_SOURCE_VERSION:=93aeafd04365cdd5dcb958cc6982c672163154ee
PKG_SOURCE_SUBDIR:=$(PKG_NAME)
PKG_MD5SUM:=
PKG_TARGETS:=bin
include $(INCLUDE_DIR)/package.mk
define barebox/Default
TITLE:=
CONFIG:=
IMAGE:=
endef
define Package/barebox/template
define Package/barebox-$(1)
SECTION:=boot
CATEGORY:=Boot Loaders
TITLE:=$(2)
DEPENDS:=#TARGET_$(1)
URL:=http://localhost/
DEFAULT:=y if (TARGET_$(1)_Default)
VARIANT:=$(1)
endef
endef
define BuildBareboxPackage
$(eval $(barebox/Default))
$(eval $(barebox/$(1)))
$(call Package/barebox/template,$(1),$(TITLE))
endef
define barebox/imx
TITLE:=Barebox for the imx.
endef
BAREBOXS:=imx
ifdef BUILD_VARIANT
$(eval $(call barebox/$(BUILD_VARIANT)))
BAREBOX_CONFIG:=$(if $(CONFIG),$(CONFIG),$(BUILD_VARIANT))
BAREBOX_IMAGE:=$(if $(IMAGE),$(IMAGE),openwrt-$(BOARD)-$(BUILD_VARIANT)-barebox.bin)
endif
define Build/Prepare
$(call Build/Prepare/Default)
endef
define Build/Configure
$(CP) ./barebox-config $(PKG_BUILD_DIR)/.config
endef
define Build/Compile
$(MAKE) -C $(PKG_BUILD_DIR) \
CROSS_COMPILE=$(TARGET_CROSS) ARCH=arm
endef
define Package/barebox/install/template
define Package/barebox-$(1)/install
$(CP) $(PKG_BUILD_DIR)/barebox.bin $(BIN_DIR)/$(2)
endef
endef
$(foreach u,$(BAREBOXS), \
$(eval $(call Package/barebox/install/template,$(u),openwrt-$(BOARD)-$(u)-barebox.bin)) \
)
$(foreach u,$(BAREBOXS), \
$(eval $(call BuildBareboxPackage,$(u))) \
$(eval $(call BuildPackage,barebox-$(u))) \
)

gmake: eval inside a recipe in function

Is there a way to do such thing in a makefile for gmake:
GOALS := g1
define fun_one
#echo "blabla" #this causes an error - maybe can't be recognized as a recipe
endef
define fun_two
$(1):
$(eval $(call fun_one,$(1)))
endef
$(forech goal, $(GOALS), $(eval $(call fun_two,$(goal))))
all: ${GOALS}
As far as I understand, I can't define a part of a recipe outside a function that defines a rule, am I write?
There's no need for the first eval; it just tells Make to enact that line while it's still parsing the definition of fun_one. Eliminate the eval and the makefile will work:
define fun_two
$(1):
$(call fun_one,$(1))
endef

Makefile question in OpenWRT build system

The following code is taken from OpenWRT project. Can someone give an abstract description? Thanks in advance!
#
# Copyright (C) 2007 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
SUBTARGETS:=clean download prepare compile install update refresh prereq dist distcheck
subtarget-default = $(filter-out ., \
$(if $($(1)/builddirs-$(2)),$($(1)/builddirs-$(2)), \
$(if $($(1)/builddirs-default),$($(1)/builddirs-default), \
$($(1)/builddirs))))
define subtarget
$(call warn_eval,$(1),t,T,$(1)/$(2): $($(1)/) $(foreach bd,$(call subtarget-default,$(1),$(2)),$(1)/$(bd)/$(2)))
endef
lastdir=$(word $(words $(subst /, ,$(1))),$(subst /, ,$(1)))
diralias=$(if $(findstring $(1),$(call lastdir,$(1))),,$(call lastdir,$(1)))
# Parameters: <subdir>
define subdir
$(call warn,$(1),d,D $(1))
$(foreach bd,$($(1)/builddirs),
$(call warn,$(1),d,BD $(1)/$(bd))
$(foreach target,$(SUBTARGETS),
$(foreach btype,$(buildtypes-$(bd)),
$(call warn_eval,$(1)/$(bd),t,T,$(1)/$(bd)/$(btype)/$(target): $(if $(QUILT),,$($(1)/$(bd)/$(btype)/$(target)) $(call $(1)//$(btype)/$(target),$(1)/$(bd)/$(btype))))
+$$(SUBMAKE) -C $(1)/$(bd) $(btype)-$(target) $(if $(findstring $(bd),$($(1)/builddirs-ignore-$(btype)-$(target))), || $(call MESSAGE, ERROR: $(1)/$(bd) [$(btype)] failed to build.))
$$(if $(call debug,$(1)/$(bd),v),,.SILENT: $(1)/$(bd)/$(btype)/$(target))
$(if $(call diralias,$(bd)),$(call warn_eval,$(1)/$(bd),l,T,$(1)/$(call diralias,$(bd))/$(btype)/$(target): $(1)/$(bd)/$(btype)/$(target)))
)
$(call warn_eval,$(1)/$(bd),t,T,$(1)/$(bd)/$(target): $(if $(QUILT),,$($(1)/$(bd)/$(target)) $(call $(1)//$(target),$(1)/$(bd))))
$(if $(BUILD_LOG),#mkdir -p $(BUILD_LOG_DIR)/$(1)/$(bd))
$(foreach variant,$(if $(BUILD_VARIANT),$(BUILD_VARIANT),$(if $($(1)/$(bd)/variants),$($(1)/$(bd)/variants),__default)),
+$(if $(BUILD_LOG),set -o pipefail;) $$(SUBMAKE) -C $(1)/$(bd) $(target) BUILD_VARIANT="$(filter-out __default,$(variant))" $(if $(BUILD_LOG),SILENT= 2>&1 | tee $(BUILD_LOG_DIR)/$(1)/$(bd)/$(target).txt) $(if $(findstring $(bd),$($(1)/builddirs-ignore-$(target))), || $(call MESSAGE, ERROR: $(1)/$(bd) failed to build$(if $(filter-out __default,$(variant)), (build variant: $(variant))).))
)
$$(if $(call debug,$(1)/$(bd),v),,.SILENT: $(1)/$(bd)/$(target))
# legacy targets
$(call warn_eval,$(1)/$(bd),l,T,$(1)/$(bd)-$(target): $(1)/$(bd)/$(target))
# aliases
$(if $(call diralias,$(bd)),$(call warn_eval,$(1)/$(bd),l,T,$(1)/$(call diralias,$(bd))/$(target): $(1)/$(bd)/$(target)))
)
)
$(foreach target,$(SUBTARGETS),$(call subtarget,$(1),$(target)))
endef
# Parameters: <subdir> <name> <target> <depends> <config options> <stampfile location>
define stampfile
$(1)/stamp-$(3):=$(if $(6),$(6),$(STAGING_DIR))/stamp/.$(2)_$(3)$(if $(5),_$(call confvar,$(5)))
$$($(1)/stamp-$(3)): $(TMP_DIR)/.build $(4)
#+$(SCRIPT_DIR)/timestamp.pl -n $$($(1)/stamp-$(3)) $(1) $(4) || \
$(MAKE) $$($(1)/flags-$(3)) $(1)/$(3)
#mkdir -p $$$$(dirname $$($(1)/stamp-$(3)))
#touch $$($(1)/stamp-$(3))
$$(if $(call debug,$(1),v),,.SILENT: $$($(1)/stamp-$(3)))
.PRECIOUS: $$($(1)/stamp-$(3)) # work around a make bug
$(1)//clean:=$(1)/stamp-$(3)/clean
$(1)/stamp-$(3)/clean: FORCE
#rm -f $$($(1)/stamp-$(3))
endef
The subdir template generates the standard make targets for a subdirectory.
It is called with the directory name as first argument, e.g. in package/Makefile it's 'package'
it then treats the variable package/builddirs as the list of subdirectories with valid build targets, which are contained in the SUBTARGETS variable.
For running the 'compile' target of a package 'foo', it allows you to run 'make package/foo/compile' which will recursively invoke make with the right environment variables in order to build the subdirectory.
This template also has support for some optional features that can be enabled through environment variables, e.g. for logging the output to a file, ignoring dependencies, etc.
It also supports selective debugging output.
The stampfile template is simply a small makefile target wrapper for speeding up builds by keeping a recursively timestamp-checked stampfile around it

Resources