I am working on GNUmake to create symlink to specific file by parsing whole directory which has a folder which needs to be linked.
Here is my makefile snippet.
TGT_LINK = /lan/test/workspace/build/tools
all_target: release_buid complete_test $(TGT_LINK)
$(TGT_LINK):
if [ ! -d $# ]; then mkdir -p $#; fi
cd $#; \
tar_ln=`\ls -d synopsystcl* | sed 's/synopsys//'`; \
sour_dir=`\ls -d synopsystcl*`; \
if ! [ -e $tar_ln ]; then \
ln -s $sour_dir $tar_ln; \
fi
Directory : /lan/test/workspace/build/tools Contains following content in it
polaris.so link.a dynamic.so kbuild.so README.txt license.txt synopsystcl5.5 build.json
Here i am trying to create symlink with name tcl5.5 pointing to synopsystcl5.5 with my above target $(TGT_LINK) code.
tcl5.5 -> synopsystcl5.5
After successful completion of two targets : release_buid complete_test , build is not proceeding to go for next target $(TGT_LINK) to create symlink. Could you please help whats wrong in code?
I would let make itself to check and recreate symlink as needed, i.e.:
TGT_LINK = /lan/test/workspace/build/tools
all_target: release_buid complete_test symlink
.PHONY: symlink
symlink: $(patsubst $(TGT_LINK)/tcl%, $(TGT_LINK)/synopsystcl%, $(wildcard $(TGT_LINK)/tcl*))
$(TGT_LINK)/synopsystcl%: $(TGT_LINK)/tcl%
set -e; \
cd $(#D); \
rm -f $(#F); \
ln -s $(<F) $(#F)
I would also consider reordering targets if there are dependencies indeed. One should never assume that dependency list is processed left to right; it will also lead to errors when parallel build (-j) is involved. If you have dependencies that something should happen before something else, it should be explicitly stated, e.g.:
all_target: symlink
symlink: complete_test
complete_test: release_buid
Related
I'm on a mac using GNU Make to manage my dotfiles. There's a directory with my emacs config files and a corresponding target in the Makefile:
all: _emacs
.PHONY: all list $(MAKECMDGOALS)
....
EMACS_SOURCE_DIR := $(abspath ./emacs)
EMACS_TARGET_DIR := $(abspath $(HOME)/.emacs.d)
EMACS_CONFIG_FILES := $(wildcard $(EMACS_SOURCE_DIR)/*.el)
_emacs: | $(EMACS_TARGET_DIR)
#echo $(call message,"Setting up config files for emacs")
$(foreach file, \
$(EMACS_CONFIG_FILES), \
ln -sf $(file) $(addsuffix /, $(EMACS_TARGET_DIR)))
$(EMACS_TARGET_DIR):
#echo "Creating directory $(EMACS_TARGET_DIR)"
#mkdir -p $#
When I run make _emacs it creates some extra links:
.emacs.d -> /Users/xxx/.emacs.d/
-sf -> -sf
early-init.el -> /Users/xxx/Projects/bootstrap/emacs/early-init.el
init-org.el -> /Users/xxx/Projects/bootstrap/emacs/init-org.el
init-pkgs.el -> /Users/xxx/Projects/bootstrap/emacs/init-pkgs.el
init.el -> /Users/xxx/Projects/bootstrap/emacs/init.el
ln -> ln
I'm struggling to understand what exactly is happening and how to avoid having the first two and the last soft links created.
In general it's a bad idea to try to construct a complex shell command using make functions inside a recipe. You should simply use shell constructs: for example use the shell for loop, not the make foreach loop.
Let's see what your recipe does:
_emacs: | $(EMACS_TARGET_DIR)
$(foreach file, \
$(EMACS_CONFIG_FILES), \
ln -sf $(file) $(addsuffix /, $(EMACS_TARGET_DIR)))
Make functions manipulate text. They don't know anything about commands, shell syntax, etc. Before make invokes the shell it first expands the script. What will this result in? This:
ln -sf .../emacs/early-init.el /Users/xxx/.emacs.d/ ln -sf .../emacs/init-org.el /Users/xxx/.emacs.d/ ln -sf ...
Maybe now you can see the problem.
If you wanted to do this using make's foreach you have to add a shell delimiter so the shell knows where one command ends and the next begins; something like:
$(foreach file, \
$(EMACS_CONFIG_FILES), \
ln -sf $(file) $(addsuffix /, $(EMACS_TARGET_DIR)) ; )
(note the ; at the end). Now when make expands it will look like this:
ln -sf .../emacs/early-init.el /Users/xxx/.emacs.d/ ; ln -sf .../emacs/init-org.el /Users/xxx/.emacs.d/ ; ln -sf ...
If I were you, I'd instead use a shell loop. It's just much simpler to understand:
for file in $(EMACS_CONFIG_FILES); do \
ln -sf $$file $(addsuffix /, $(EMACS_TARGET_DIR)) ; \
done
But, for what you want to do you don't need a loop at all; you can link multiple files into the same directory with one command:
ln -sf $(EMACS_CONFIG_FILES) $(EMACS_TARGET_DIR)
(I'm not sure what the addsuffix was needed for, or why you couldn't just write it as $(EMACS_TARGET_DIR)/ without the addsuffix)
I've to add a file and a folder to the zip that is created when I run make dist command. This is an open-source project.
After research, I understood I've to modify the Makefile.am but examples online don't work or match with my current Makefile.am
Makefile.am
SUBDIRS = bin data po src extensions docs
DISTCLEANFILES = \
intltool-extract \
intltool-merge \
intltool-update
EXTRA_DIST = \
$(bin_SCRIPTS) \
intltool-merge.in \
intltool-update.in \
intltool-extract.in
DISTCHECK_CONFIGURE_FLAGS = --disable-update-mimedb
check-po:
#for i in $(top_srcdir)/po/*.po ; do \
if ! grep -q ^`basename $$i | \
sed 's,.po,,'`$$ $(top_srcdir)/po/LINGUAS ; then \
echo '***' `basename $$i | \
sed 's,.po,,'` missing from po/LINGUAS '***' ; \
exit 1; \
fi; \
done;
lint:
flake8 --ignore E402 $(top_srcdir)/src $(top_srcdir)/extensions
test: lint check-po
PYTHONPATH=$(pkgdatadir)/extensions:$(PYTHONPATH) \
python -m sugar3.test.discover $(top_srcdir)/tests
configure.ac
AC_INIT([Sugar],[0.114],[],[sugar])
AC_PREREQ([2.59])
AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_SRCDIR([configure.ac])
SUCROSE_VERSION="0.114"
AC_SUBST(SUCROSE_VERSION)
AM_INIT_AUTOMAKE([1.9 foreign dist-xz no-dist-gzip])
AM_MAINTAINER_MODE
PYTHON=python2
AM_PATH_PYTHON
AC_PATH_PROG([EMPY], [empy])
if test -z "$EMPY"; then
AC_MSG_ERROR([python-empy is required])
fi
PKG_CHECK_MODULES(SHELL, gtk+-3.0)
IT_PROG_INTLTOOL([0.35.0])
GETTEXT_PACKAGE=sugar
AC_SUBST([GETTEXT_PACKAGE])
AM_GLIB_GNU_GETTEXT
AC_ARG_ENABLE(update-mimedb,
AC_HELP_STRING([--disable-update-mimedb],
[disable the update-mime-database after install [default=no]]),,
enable_update_mimedb=yes)
AM_CONDITIONAL(ENABLE_UPDATE_MIMEDB, test x$enable_update_mimedb = xyes)
GLIB_GSETTINGS
AC_CONFIG_FILES([
bin/Makefile
bin/sugar
data/icons/Makefile
data/Makefile
extensions/cpsection/aboutcomputer/Makefile
extensions/cpsection/aboutme/Makefile
extensions/cpsection/background/Makefile
extensions/cpsection/backup/Makefile
extensions/cpsection/backup/backends/Makefile
extensions/cpsection/datetime/Makefile
extensions/cpsection/frame/Makefile
extensions/cpsection/keyboard/Makefile
extensions/cpsection/language/Makefile
extensions/cpsection/modemconfiguration/Makefile
extensions/cpsection/Makefile
extensions/cpsection/network/Makefile
extensions/cpsection/power/Makefile
extensions/cpsection/updater/Makefile
extensions/cpsection/webaccount/services/Makefile
extensions/cpsection/webaccount/Makefile
extensions/deviceicon/Makefile
extensions/globalkey/Makefile
extensions/webservice/Makefile
extensions/Makefile
Makefile
po/Makefile.in
src/jarabe/config.py
src/jarabe/controlpanel/Makefile
src/jarabe/desktop/Makefile
src/jarabe/frame/Makefile
src/jarabe/intro/Makefile
src/jarabe/journal/Makefile
src/jarabe/Makefile
src/jarabe/model/Makefile
src/jarabe/model/update/Makefile
src/jarabe/util/Makefile
src/jarabe/util/telepathy/Makefile
src/jarabe/view/Makefile
src/jarabe/webservice/Makefile
src/Makefile
])
AC_OUTPUT
When I run the command make dist, the output zip doesn't include a file and folder which I now need to add. I'm not able to understand where in the code(Makefile.am or configure.ac) should I make changes.
I've to add a file and a folder to the zip that is created when I run make dist command.
I take it that these are not already included in the distribution. If you're not sure, then check -- Automake-based build systems such as yours identify a lot of files automatically for inclusion in distribution packages.
Supposing that these files are not already included, there are several ways to cause them to be. Easiest would be to add them to the EXTRA_DIST variable, yielding
EXTRA_DIST = \
$(bin_SCRIPTS) \
intltool-merge.in \
intltool-update.in \
intltool-extract.in \
a_directory \
some_file.ext
Don't forget the trailing backslashes if you continue with the multiline form (which I like, as I find it much easier to read). You can specify a path to the file, the directory, or both. Do note that in the case of the directory, it will be not just the directory itself but all its contents, recursively, that are included in the distribution. This is all documented in the manual.
If you need finer control, then there is also an extension point for managing the contents of the distribution in the form of the "dist hook". This comprises a make target named dist-hook. Like any other literal make rule in your Makefile.am, any rule you provide for building that target is copied to the final generated Makefile, and if such a rule is present then its recipe is run as part of building the distribution, after the distribution directory is otherwise populated but before the archive file is built from that. You can write more or less arbitrary shell code in that target's recipe to tweak the distribution. Follow the above link to the documentation for the gory details.
EXTRA_DIST variable sounds like the thing.
I've been building freedesktop cppunit with mingw
https://www.freedesktop.org/wiki/Software/cppunit/
I've made some fixes to source files and makefiles and been able to
successfully execute commmands:
./autogen.sh
./configure
make
without any errors.
There was a need to set
m4_DATA = m4
instead of value "cppunit.m4" in Makefile.am(there was no such dir in build and it looks like such dir is "m4" dir).
After successful make execution doing
make --debug install
failed with error:
File install-m4DATA not found
from Makefile.am:
m4dir = $(datadir)/aclocal //what is datadir btw?
automake generated Makefile task:
install-m4DATA: $(m4_DATA)
#$(NORMAL_INSTALL) // fails at this line
test -z "$(m4dir)" || $(MKDIR_P) "$(DESTDIR)$(m4dir)"
#list='$(m4_DATA)'; test -n "$(m4dir)" || list=; \
for p in $$list; do \
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
echo "$$d$$p"; \
done | $(am__base_list) | \
while read files; do \
echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(m4dir)'"; \
$(INSTALL_DATA) $$files "$(DESTDIR)$(m4dir)" || exit $$?; \
done
before that task NORMAL_INSTALL is set to:
NORMAL_INSTALL = :
How to fix "make install" execution.
Will it work if i have only mingw envieronment on my PC?
Version is 1.13.2 fresh from git repo.
I also post lines from "make --debug install" output
File 'install-m4DATA' does not exist.
Must remake target 'install-m4DATA'.
test -z "/usr/local/share/aclocal" || /usr/bin/mkdir -p "/usr/local/share/aclocal"
/usr/bin/install -c -m 644 ./m4 '/usr/local/share/aclocal'
Makefile:432: recipe for target 'install-m4DATA' failed
make[2]: Leaving directory 'c:/Users/user/projects/cppunit'
Makefile:799: recipe for target 'install-am' failed
make[1]: Leaving directory 'c:/Users/user/projects/cppunit'
Makefile:479: recipe for target 'install-recursive' failed
It also prints that that script omits directory at line
/usr/bin/install -c -m 644 ./m4 '/usr/local/share/aclocal'
Possibly here must go files from directory but not directory itself.
How to fix it to do that(i'm not familiar with Makefiles and bash)?
I have been able to compile a specific version of OpenSSL for iOS devices, and I am now trying to compile for Mac OSX. However, when I run my bash script (provided below) I am getting the following error:
ar r ../../libcrypto.a o_names.o obj_dat.o obj_lib.o obj_err.o obj_xref.o
ar: ../../libcrypto.a is a fat file (use libtool(1) or lipo(1) and ar(1) on it)
ar: ../../libcrypto.a: Inappropriate file type or format
When I run lipo -info libcrypto.a I get the following result:
Architectures in the fat file: libcrypto.a are: i386 x86_64
This does not make any sense, as my bash script is only configuring OpenSSL for i386 (I was looping to do both, but removed x86_64 once I started getting these problems).
I have tried following the answers for similar SO questions here and here. However, those yielded the same results. Additionally, the Mac installation instructions on the OpenSSL Wiki were of no help either.
My scripts:
Build.sh
projectDir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
ARCHS=("i386")
FIPS_VERSION="2.0.12"
OPENSSL_VERSION="1.0.2g"
rm -rf openssl* fips*
if [ -d "out" ]; then
rm -rf out
fi
mkdir out
source ./Build-FIPS.sh
cd $projectDir
source ./Build-OpenSSL.sh
Build-OpenSSL.sh
set -e
function main() {
verifyopenssl
for ((i=0; i < ${#ARCHS[#]}; i++))
do
makeopenssl "${ARCHS[i]}"
done
}
function verifyopenssl() {
gpg --verify $projectDir/../Source/openssl-$OPENSSL_VERSION.tar.gz.asc
tar -zxf $projectDir/../Source/openssl-$OPENSSL_VERSION.tar.gz
cd openssl-$OPENSSL_VERSION
}
function makeopenssl() {
BUILD_ARCH=$1
SDK_NAME="macosx"
GCC=$(xcrun -sdk ${SDK_NAME} -find gcc)
SDK_PATH=$(xcrun -sdk ${SDK_NAME} --show-sdk-path)
MACHINE="darwin-i386-cc"
# BSD_ARCH="BSD-generic32"
CONFIG_ARGS="$MACHINE \
$BSD_ARCH \
--openssldir=$projectDir/out/openssl_${BUILD_ARCH} \
fips \
--with-fipsdir=${projectDir}/out/fips_${BUILD_ARCH} \
no-idea \
no-cast \
no-seed \
no-md2 \
no-sha0 \
no-whirlpool \
-DL_ENDIAN"
export CC="${GCC} -arch ${BUILD_ARCH}"
export CFLAGS="-isysroot ${SDK_PATH} -I ${projectDir}/out/fips_${BUILD_ARCH}/include"
export LDFLAGS="-arch $BUILD_ARCH"
./Configure ${CONFIG_ARGS}
make depend
make
# make install
# make clean && make dclean
}
main $#
Following #jww's answer, I found that changing the following line (around line 69) in the main Makefile (the one in the root folder) solved the ar linking problem that #jww mentioned:
AR= ar $(ARFLAGS) r to AR= libtool -o
Making this change did get me further along in the process. However, I began having other problems. Further "research" led me to the OpenSSL FAQ page which had a question talking about OpenSSL failing to build on Mac. It pointed me to the PROBLEMS file in the root directory of the OpenSSL source code. That file said that there is a MAC ld problem:
This is really a misfeature in ld, which seems to look for .dylib
libraries along the whole library path before it bothers looking for
.a libraries. This means that -L switches won't matter unless OpenSSL
is built with shared library support.
The workaround may be to change the following lines in apps/Makefile
and test/Makefile:
LIBCRYPTO=-L.. -lcrypto
LIBSSL=-L.. -lssl
to:
LIBCRYPTO=../libcrypto.a
LIBSSL=../libssl.a
With this information, I created a patch file for the root Makefile and the Makefile in the apps folder. I also found that I had to comment out the instructions in the main Makefile and the apps/Makefile to build the openssl binary / executable. This should only be necessary if you want to run make install.
The patch files exists at the same level as the Build.sh script. And after fiddling around with my Build-OpenSSL.sh script I was finally able to get it to build for both i386 and x86_64.
For future reference, I am including the complete contents of the two patch files, and the original two script files below.
Build.sh
#!/bin/bash
#
projectDir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
ARCHS=("i386" "x86_64")
FIPS_VERSION="2.0.12"
OPENSSL_VERSION="1.0.2g"
rm -rf openssl*
if [ -d "out" ]; then
rm -rf out
fi
mkdir out
source ./Build-FIPS.sh
source ./Build-OpenSSL.sh
Build-OpenSSL.sh
#!/bin/bash
#
set -e
function main() {
verifyopenssl
for ((i=0; i < ${#ARCHS[#]}; i++))
do
makeopenssl "${ARCHS[i]}"
done
}
function verifyopenssl() {
gpg --verify $projectDir/../Source/openssl-$OPENSSL_VERSION.tar.gz.asc
tar -zxf $projectDir/../Source/openssl-$OPENSSL_VERSION.tar.gz
cd openssl-$OPENSSL_VERSION
}
function makeopenssl() {
BUILD_ARCH=$1
SDK_NAME="macosx"
GCC=$(xcrun -sdk ${SDK_NAME} -find gcc)
SDK_PATH=$(xcrun -sdk ${SDK_NAME} --show-sdk-path)
if [[ $BUILD_ARCH = "i386" ]]; then
MACHINE="darwin-i386-cc"
NISTP=""
elif [[ $BUILD_ARCH = "x86_64" ]]; then
MACHINE="darwin64-x86_64-cc"
NISTP="enable-ec_nistp_64_gcc_128"
else
exit
fi
CONFIG_ARGS="$MACHINE \
$NISTP \
--openssldir=$projectDir/out/openssl_${BUILD_ARCH} \
fips \
--with-fipsdir=${projectDir}/out/fips_${BUILD_ARCH} \
no-idea \
no-cast \
no-seed \
no-md2 \
no-sha0 \
no-whirlpool \
-DL_ENDIAN"
./Configure ${CONFIG_ARGS}
patch Makefile < ../MainMake.patch
patch apps/Makefile < ../AppMake.patch
make depend
make build_libcrypto build_libssl
make install_sw
make clean && make dclean
patch -R Makefile < ../MainMake.patch
patch -R apps/Makefile < ../AppMake.patch
}
main $#
AppMake.patch
--- apps/Makefile 2016-03-01 06:36:53.000000000 -0700
+++ ../Makefile 2016-05-06 13:00:16.000000000 -0600
## -26,8 +26,8 ##
DLIBCRYPTO=../libcrypto.a
DLIBSSL=../libssl.a
-LIBCRYPTO=-L.. -lcrypto
-LIBSSL=-L.. -lssl
+LIBCRYPTO=../libcrypto.a
+LIBSSL=../libssl.a
PROGRAM= openssl
## -101,24 +101,24 ##
$(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO
install:
- #[ -n "$(INSTALLTOP)" ] # should be set by top Makefile...
- #set -e; for i in $(EXE); \
- do \
- (echo installing $$i; \
- cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$i.new; \
- chmod 755 $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$i.new; \
- mv -f $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$i.new $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$i ); \
- done;
- #set -e; for i in $(SCRIPTS); \
- do \
- (echo installing $$i; \
- cp $$i $(INSTALL_PREFIX)$(OPENSSLDIR)/misc/$$i.new; \
- chmod 755 $(INSTALL_PREFIX)$(OPENSSLDIR)/misc/$$i.new; \
- mv -f $(INSTALL_PREFIX)$(OPENSSLDIR)/misc/$$i.new $(INSTALL_PREFIX)$(OPENSSLDIR)/misc/$$i ); \
- done
- #cp openssl.cnf $(INSTALL_PREFIX)$(OPENSSLDIR)/openssl.cnf.new; \
- chmod 644 $(INSTALL_PREFIX)$(OPENSSLDIR)/openssl.cnf.new; \
- mv -f $(INSTALL_PREFIX)$(OPENSSLDIR)/openssl.cnf.new $(INSTALL_PREFIX)$(OPENSSLDIR)/openssl.cnf
+ # #[ -n "$(INSTALLTOP)" ] # should be set by top Makefile...
+ # #set -e; for i in $(EXE); \
+ # do \
+ # (echo installing $$i; \
+ # cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$i.new; \
+ # chmod 755 $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$i.new; \
+ # mv -f $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$i.new $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$i ); \
+ # done;
+ # #set -e; for i in $(SCRIPTS); \
+ # do \
+ # (echo installing $$i; \
+ # cp $$i $(INSTALL_PREFIX)$(OPENSSLDIR)/misc/$$i.new; \
+ # chmod 755 $(INSTALL_PREFIX)$(OPENSSLDIR)/misc/$$i.new; \
+ # mv -f $(INSTALL_PREFIX)$(OPENSSLDIR)/misc/$$i.new $(INSTALL_PREFIX)$(OPENSSLDIR)/misc/$$i ); \
+ # done
+ # #cp openssl.cnf $(INSTALL_PREFIX)$(OPENSSLDIR)/openssl.cnf.new; \
+ # chmod 644 $(INSTALL_PREFIX)$(OPENSSLDIR)/openssl.cnf.new; \
+ # mv -f $(INSTALL_PREFIX)$(OPENSSLDIR)/openssl.cnf.new $(INSTALL_PREFIX)$(OPENSSLDIR)/openssl.cnf
tags:
ctags $(SRC)
MainMake.patch
--- Makefile 2016-05-06 13:06:11.000000000 -0600
+++ ../Makefile 2016-05-06 13:06:44.000000000 -0600
## -602,8 +602,8 ##
chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/libcrypto.pc
cp libssl.pc $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/pkgconfig
chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/libssl.pc
- cp openssl.pc $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/pkgconfig
- chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/openssl.pc
+ # cp openssl.pc $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/pkgconfig
+ # chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/openssl.pc
install_html_docs:
here="`pwd`"; \
ar r ../../libcrypto.a o_names.o obj_dat.o obj_lib.o obj_err.o obj_xref.o
ar: ../../libcrypto.a is a fat file (use libtool(1) or lipo(1) and ar(1) on it)
ar: ../../libcrypto.a: Inappropriate file type or format
ar, libtool and -arch is the reason the answer says "... supplying -arch x86_64 -arch i386 will result in a build failure because of the way OpenSSL's build system forms commands" at Build Multiarch OpenSSL on OS X.
You need to use Apple's libtool, and stop using ar. Apple's libtool knows about architectures, ar does not.
Another small wrinkle is the makefile does something like this, if I recall correctly. It makes it difficult to simply use Apple's libtool, and stop using ar:
$(AR) $(ARFLAGS) $# ...
In many makefiles you can simply make AR="libtool -o", but this case is different because the command comes out libtool -o r libcrypto.a or similar. I also seem to recall something like make AR="libtool" ARFLAGS="r -o $#" does not work well either.
I used to patch the makefile after config to do it.
I compiled the source code with the Makefile, I got Makefile Error:
/bin/sh: line 8: : command not found
make: *** [lib_build] Error 127
My lib_build target is as below:
lib_build:
#echo "--------------------------------------------------------------------";
#echo "VZW Compiling DM Agent 3rd party and native Libraries..." ;
#echo "--------------------------------------------------------------------";
mkdir -p $(VZW_LIB_DIR) ; \
mkdir -p $(VZW_BIN_DIR) ; \
mkdir -p $(VZW_SCR_DIR) ; \
mkdir -p $(VZW_CFG_DIR) ; \
mkdir -p $(VZW_OBJ_DIR) ; \
mkdir -p $(VZW_LOG_DIR) ; \
cd $(VZW_BASE_DIR)/lib/ ; \
make all ; \
cd $(VZW_SYNCML_DIR)/src/bld/linux ; \
make all;
cp -r $(VZW_SYNCML_DIR)/bin/linux/libsml.so $(VZW_LIB_DIR) ;
cp -r $(VZW_SYNCML_DIR)/bin/linux/libxpt.so $(VZW_LIB_DIR) ;
cp -r $(VZW_BASE_DIR)/3rd_party/iksemel-1.4/src/.libs/* $(VZW_LIB_DIR) ;
It was working fine then I try to modify some line in the above source code and later reverted everything. Then something went wrong and I got the error. I am not able to understand what went wrong.
One more thing to add here. Is there any way to know in which line exactly in the Makefile this kind of problem is happening. If there is no way then it is very difficult to spot these kind of problems.
I would suggest restructuring the commands. As the rule is written, it ignores all errors because this is how shell works. At least prepend set -e to this sequence of shell commands.
A lot more mind-tweaking to find if any syntactical mistake is there, I found the solution that there was a space after a line in Makefile ie. after the "/"
cd $(VZW_SYNCML_DIR)/src/bld/linux ; \
This was very difficult to spot though as spaces are not visible.