I have a project using autoconf/automake. Sometimes I want to remake part of it even though make (correctly) believes all dependencies are up-to-date. For other projects I can use make -W some-file.c to ask make to pretend that some-file.c is new and rebuild accordingly. (Option -W is also called --what-if, --new-file and --assume-new.) However this doesn't work with automake's Makefiles - nothing happens, as if the option is ignored. Is there any way to get this feature working?
I am using automake (GNU automake) 1.16.2 and autoconf (GNU Autoconf) 2.69
Example configure.ac
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
AC_PREREQ([2.69])
AC_INIT([FULL-PACKAGE-NAME], [VERSION], [BUG-REPORT-ADDRESS])
AM_INIT_AUTOMAKE
AC_CONFIG_SRCDIR([zot.c])
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_FILES([Makefile])
AC_PROG_CC
AC_OUTPUT
Example Makefile.am
bin_PROGRAMS=zot
zot_SOURCES=zot.c
Example zot.c file
int main() { return 0;}
Example session
$ ./configure && make
checking for a BSD-compatible install... /usr/bin/install -c
(autoconf output omitted)
config.status: executing depfiles commands
make all-am
make[1]: Entering directory '/tmp/meo'
gcc -DHAVE_CONFIG_H -I. -g -O2 -MT zot.o -MD -MP -MF .deps/zot.Tpo -c -o zot.o zot.c
mv -f .deps/zot.Tpo .deps/zot.Po
gcc -g -O2 -o zot zot.o
make[1]: Leaving directory '/tmp/meo'
$ make
make all-am
make[1]: Entering directory '/tmp/meo'
make[1]: Leaving directory '/tmp/meo'
I would expect the following command to re-compile zot.c and re-link
$ make -W zot.c
make all-am
make[1]: Entering directory '/tmp/meo'
make[1]: Leaving directory '/tmp/meo'
however make does not do anything as everything were up to date.
Related
I install Lapack-3.6.1 on Ubutun.There is a problem during make, lack of the file (cholrl.a). The error message is this.
make[1]: Leaving directory '/usr/local/src/lapack-3.6.1/BLAS/SRC' ( cd
SRC/VARIANTS ; make) make[1]: Entering directory
'/usr/local/src/lapack-3.6.1/SRC/VARIANTS' gfortran -O2 -frecursive
-c cholesky/RL/cpotrf.f -o cholesky/RL/cpotrf.o gfortran -O2 -frecursive -c cholesky/RL/dpotrf.f -o cholesky/RL/dpotrf.o gfortran -O2 -frecursive -c cholesky/RL/spotrf.f -o cholesky/RL/spotrf.o gfortran -O2 -frecursive -c cholesky/RL/zpotrf.f -o
cholesky/RL/zpotrf.o ar cr LIB/cholrl.a cholesky/RL/cpotrf.o
cholesky/RL/dpotrf.o cholesky/RL/spotrf.o cholesky/RL/zpotrf.o ar:
LIB/cholrl.a: No such file or directory Makefile:38: recipe for target
'cholrl' failed make[1]: * [cholrl] Error 1 make[1]: Leaving
directory '/usr/local/src/lapack-3.6.1/SRC/VARIANTS' Makefile:39:
recipe for target 'variants' failed make: * [variants] Error 2
Do you have a solution?
Creating LIB directory myself worked for me. So, type mkdir LIB in SRC/VARIANTS.
I am trying to learn how to compile using gcc/makefile
If I use the makefile below everything works.
all:
g++ .\src\hello.cpp -o helloworld
But What I would like is to specify the source folder and files.
INCLUDEPATHS= \
-I".\src\"
CFLAGS= -Wall -g $(INCLUDEPATHS)
all:
helloworld
But that does not seem to work, the error I get is
make all
make: *** No rule to make target `hello.exe', needed by `all'. Stop.
How do I change my makefile to have the include path defined?
I'm trying to use mpi-ikl-simplemkl-1.0 (http://www.mloss.org/software/view/174/)
I'm using Windows 8.1 and I've installed cgywin64. When I type (on cgywin bash screen):
make -f Makefile
The result is:
gcc-4.2 -03 -ffast-math -fomit-frame-pointer -fPIC -c -o svm.o svm.cpp
gcc-4.2: error: spawn: No such file or directory
makefile:32: recipe for target 'svm.o' failed
make: *** [svm.o] Error 1
What should I do?
The internet wisdom seems to be that you should do one of:
Remove /bin from PATH
Remove /usr/bin from PATH
Reinstall gcc (possibly remove all versions of gcc first)
I am now installing a code on my mac.
The code is from here. Look for "Benchmark and Boundary Detection Code" in this page.
In the readme file, it says:
(1) For the image and segmentation reading routines in the Dataset
directory to work, make sure you edit Dataset/bsdsRoot.m to point to
your local copy of the BSDS dataset.
(2) Run 'gmake install' from this directory to build everything. You
should then probably put the lib/matlab directory in your MATLAB path.
(3) Read the Benchmark/README file.
For the 1st step, I did as suggested.
For the 2nd step, I am pretty confused. I ran command gmake install in MATLAB, however, I got:
gmake
Undefined function or variable 'gmake'.
Actually, before running MATLAB, I installed gmake port through macports.
I just did it in terminal, however, this is what I got...
hou229:segbench yaozhongsong$ cd /Users/yaozhongsong/Documents/MATLAB/segbench
hou229:segbench yaozhongsong$ sudo gmake install
gmake[1]: execvp: ../Util/gethosttype: Permission denied
gmake[1]: Entering directory `/Users/yaozhongsong/Documents/MATLAB/segbench/Util'
GNUmakefile-library:26: *** mexSuffix not defined. Stop.
gmake[1]: Leaving directory `/Users/yaozhongsong/Documents/MATLAB/segbench/Util'
hou229:segbench yaozhongsong$
In MATLAB, I also did like this:
!gmake install
/bin/bash: gmake: command not found
How to do the 2nd step in readme file?
Thanks in advance!
#Amro
hou229:segbench yaozhongsong$ cd /Users/yaozhongsong/Documents/MATLAB/segbench
hou229:segbench yaozhongsong$ sudo gmake install
Password:
gmake[1]: execvp: ../Util/gethosttype: Permission denied
gmake[1]: Entering directory `/Users/yaozhongsong/Documents/MATLAB/segbench/Util'
mkdir -p ../lib/matlab
g++ -g -Wall -fPIC -I../include -O3 -DNOBLAS -c Exception.cc -o build//Exception.o
g++ -g -Wall -fPIC -I../include -O3 -DNOBLAS -c String.cc -o build//String.o
g++ -g -Wall -fPIC -I../include -O3 -DNOBLAS -c Random.cc -o build//Random.o
g++ -g -Wall -fPIC -I../include -O3 -DNOBLAS -c Timer.cc -o build//Timer.o
g++ -g -Wall -fPIC -I../include -O3 -DNOBLAS -c Matrix.cc -o build//Matrix.o
Matrix.cc:13:21: error: ieee754.h: No such file or directory
Matrix.cc: In function ‘double nextpow2(double)’:
Matrix.cc:86: error: ‘ieee754_double’ was not declared in this scope
Matrix.cc:86: error: expected `;' before ‘val’
Matrix.cc:87: error: ‘val’ was not declared in this scope
Matrix.cc:88: error: ‘IEEE754_DOUBLE_BIAS’ was not declared in this scope
Matrix.cc: At global scope:
Matrix.cc:48: warning: ‘snan’ defined but not used
Matrix.cc:49: warning: ‘inf’ defined but not used
gmake[1]: *** [build//Matrix.o] Error 1
gmake[1]: Leaving directory `/Users/yaozhongsong/Documents/MATLAB/segbench/Util'
For the "mexSuffix not defined" error, first run mexext inside MATLAB, take that output (I suspect it is mexmaci64), edit the file Util/GNUmakefile-library and add the following at line 24:
mexSuffix := mexmaci64
replace the value with the one you get from mexext
Note: I haven't tested any of this, I am on a Windows machine..
You need to run gmake from the Terminal (command line), not in MATLAB.
Trying to compile libptrace (http://sourceforge.net/projects/libptrace/). The project has not advertised any preferred means of requesting support (Unfortunately, this project hasn't indicated the best way to get help). Anywho, the problem I'm running into is as follows:
% ./build.sh
% ...[SUCCESS]
% ./configure
% ...[SUCCESS]
% make
Making all in src
make[2]: Entering directory `/home/xxx/build/libptrace-git.git/src'
make[2]: *** No rule to make target `../lib/libgnu.la', needed by `libptrace.la'. Stop.
make[2]: Leaving directory `/home/xxx/build/libptrace-git.git/src'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/xxx/build/libptrace-git.git'
make: *** [all] Error 2
%
If you google libptrace and libgnu.la, you get zero hits. Grepping for it in the source take fresh out of git, you get:
% grep -sre libgnu.la *
src/Makefile.in:libptrace_la_DEPENDENCIES = ../lib/libgnu.la
src/Makefile.in:libptrace_la_LIBADD = ../lib/libgnu.la
src/Makefile.am:libptrace_la_LIBADD = ../lib/libgnu.la
src/Makefile:libptrace_la_DEPENDENCIES = ../lib/libgnu.la
src/Makefile:libptrace_la_LIBADD = ../lib/libgnu.la
I have no idea how to generate a libtool archive file, and source doesn't seem to have any make targets or scripts otherwise to do so.
An note on admin: please add the tag `libptrace' to this question - obviously a very popular topic - I can't do so as I don't meet the 1.5K point count :(
In response to Mel's amendment to build.sh, Here are the new errors generated on `make':
gcc -DHAVE_CONFIG_H -I. -I../.. -I../../src -g -O2 -Wall -MT test-linux-dlsym.o -MD -MP -MF .deps/test-linux-dlsym.Tpo -c -o test-linux-dlsym.o test-linux-dlsym.c
mv -f .deps/test-linux-dlsym.Tpo .deps/test-linux-dlsym.Po
/bin/sh ../../libtool --tag=CC --mode=link gcc -g -O2 -Wall -o test-linux-dlsym test-linux-dlsym.o ../../src/libptrace.la
libtool: link: gcc -g -O2 -Wall -o .libs/test-linux-dlsym test-linux-dlsym.o ../../src/.libs/libptrace.so -Wl,-rpath -Wl,/usr/local/lib
test-linux-dlsym.o: In function `main':
/home/XXX/dev/insecurity/build/libptrace-git/tests/linux/test-linux-dlsym.c:24: undefined reference to `ptrace_elf_get_link_map_head'
/home/XXX/dev/insecurity/build/libptrace-git/tests/linux/test-linux-dlsym.c:40: undefined reference to `ptrace_elf_get_link_map_next'
/home/XXX/dev/insecurity/build/libptrace-git/tests/linux/test-linux-dlsym.c:31: undefined reference to `ptrace_elf_get_symtab'
/home/XXX/dev/insecurity/build/libptrace-git/tests/linux/test-linux-dlsym.c:32: undefined reference to `ptrace_elf_get_strtab'
/home/XXX/dev/insecurity/build/libptrace-git/tests/linux/test-linux-dlsym.c:33: undefined reference to `ptrace_elf_get_hash'
/home/XXX/dev/insecurity/build/libptrace-git/tests/linux/test-linux-dlsym.c:34: undefined reference to `ptrace_elf_get_hash_chains'
collect2: ld returned 1 exit status
make[2]: *** [test-linux-dlsym] Error 1
make[2]: Leaving directory `/home/XXX/dev/insecurity/build/libptrace-git.git/tests/linux'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/XXX/dev/insecurity/build/libptrace-git.git'
make: *** [all] Error 2
This is gnulib: http://www.gnu.org/software/gnulib/
It can be install in Debian with apt-get install gnulib
builds on Ubuntu 10.10, gnulib is required as noted above and probably a whole bunch of build tools (autoconf, automake)
below patch fixes a link error which occurs when building git cc97c9e3d830bd1d567011ec099846343cef547a
diff --git a/src/Makefile.am b/src/Makefile.am
index 6de8cf2..5f8d9bc 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
## -23,8 +23,8 ## endif
if TARGET_LINUX
libptrace_la_SOURCES += libptrace_linux.c libptrace_linux.h \
libptrace_wrapper.c libptrace_wrapper.h \
- libptrace_linux_procfs.c libptrace_linux_procfs.h
-# libptrace_elf.c libptrace_elf.h
+ libptrace_linux_procfs.c libptrace_linux_procfs.h \
+ libptrace_elf.c libptrace_elf.h
libptrace_la_HEADERS += libptrace_linux.h libptrace_wrapper.h
if TARGET_I386
libptrace_la_SOURCES += libptrace_linux_x86.c libptrace_linux_x86.h
## -38,8 +38,8 ## endif
if TARGET_FREEBSD
libptrace_la_SOURCES += libptrace_freebsd.c libptrace_freebsd.h \
- libptrace_wrapper.c libptrace_wrapper.h
-# libptrace_elf.c libptrace_elf.h
+ libptrace_wrapper.c libptrace_wrapper.h \
+ libptrace_elf.c libptrace_elf.h
libptrace_la_HEADERS += libptrace_freebsd.h libptrace_wrapper.h
if TARGET_I386
libptrace_la_SOURCES += libptrace_freebsd_x86.c libptrace_freebsd_x86.h
First of all, this only works on linux. If you want this to work on other systems, you will need to write a src/libptrace_config.h header in configure.ac as can be seen by grep COMPILE_HDR configure.ac.
Secondly, the following patch is all I need to get the point where the generated header is missing on my system. Of course gnulib needs to be installed and gnulib-tool must be in $PATH.
diff --git a/build.sh b/build.sh
index 81caf8a..cc195c4 100755
--- a/build.sh
+++ b/build.sh
## -1,7 +1,7 ##
#!/bin/sh
# Import gnulib modules which we use
-gnulib-tool --import stdint
+gnulib-tool --libtool --import stdint
# Update timestamp to make sure autoconf rebuilds everything.
touch configure.ac