“No rule to make target `clean'. Stop.” issue - makefile

Can someone explain please where is the mistake ?
Trying to install drivers for NIC which was download from official website and getting error:
[root#london r8169-6.023.02]# make clean modules
make -C src/ clean
make[1]: Entering directory `/home/av/r8169-6.023.02/src'
make -C /lib/modules/3.10.0-327.36.3.el7.x86_64/build SUBDIRS=/home/av/r8169-6.023.02/src clean
make[2]: Entering directory `/usr/src/kernels/3.10.0-327.36.3.el7.x86_64'
make[2]: *** No rule to make target `clean'. Stop.
make[2]: Leaving directory `/usr/src/kernels/3.10.0-327.36.3.el7.x86_64'
make[1]: *** [clean] Error 2
make[1]: Leaving directory `/home/av/r8169-6.023.02/src'
make: *** [clean] Error 2
[root#london r8169-6.023.02]#
So the manual provided by Realtek says:
If you are running the target kernel, then you should be able to do :
# make clean modules (as root or with sudo)
# make install
# depmod -a
# modprobe r8169
Makefile is:
KFLAG := 2$(shell uname -r | sed -ne 's/^2\.[4]\..*/4/p')x
all: clean modules install
modules:
ifeq ($(KFLAG),24x)
$(MAKE) -C src/ -f Makefile_linux24x modules
else
$(MAKE) -C src/ modules
endif
clean:
ifeq ($(KFLAG),24x)
$(MAKE) -C src/ -f Makefile_linux24x clean
else
$(MAKE) -C src/ clean
endif
install:
ifeq ($(KFLAG),24x)
$(MAKE) -C src/ -f Makefile_linux24x install
else
$(MAKE) -C src/ install
endif
Additional info
[root#london r8169-6.023.02]# lsmod | grep r8169
[root#london r8169-6.023.02]#
and directory with Makefile
[root#london r8169-6.023.02]# ls -lah
total 24K
drwxrwxrwx 3 root root 4.0K Sep 26 16:50 .
drwx------. 4 av av 4.0K Nov 28 16:21 ..
-rwxrwxrwx 1 root root 2.0K Oct 20 10:23 Makefile
-rwxrwxrwx 1 root root 4.4K Oct 20 10:23 readme
drwxrwxrwx 2 root root 4.0K Sep 26 16:50 src
[root#london r8169-6.023.02]#
Thanks in advance

Dont worry..
There are only some packages need to be intalled.
type sudo synaptic in terminal and enter.
in search box type qt4-qmake and mark for installation.
then same as above search libqt4-dev and libxml2-dev and do the same mark for installation simultaneously.
then apply without check the download option.
Then go to cd netanim directory and type make clean and enter,
if it does not work type qmake NetAnim.pro and enter, it takes couple of seconds.
then type make and enter.
Here its done, it will take less then a minute.
Now in netanim directory tyoe ./NetAnim and enter.
Here you will see animation interface.
Good luck

Related

dependency on file created by recursive make

Here's a minimal example of what I'm trying to do.
Directory structure:
.
├── Makefile
└── subdir
├── a
└── Makefile
./subdir/Makefile:
a.copy: a
cp a a.copy
./Makefile:
.PHONY: build_subdir
a.copy: subdir/a.copy
cp subdir/a.copy a.copy
build_subdir:
$(MAKE) -C subdir
subdir/a.copy: build_subdir
The first time I run make, everything's fine:
$ make
make -C subdir
make[1]: Entering directory `/home/kkourt/src/tests/make/subdir'
cp a a.copy
make[1]: Leaving directory `/home/kkourt/src/tests/make/subdir'
cp subdir/a.copy a.copy
Re-runing make is also fine (nothing happens):
$ make
make -C subdir
make[1]: Entering directory `/home/kkourt/src/tests/make/subdir'
make[1]: `a.copy' is up to date.
make[1]: Leaving directory `/home/kkourt/src/tests/make/subdir'
If I update subdir/a, however, ./a is not updated:
$ touch subdir/a
$ make
make -C subdir
make[1]: Entering directory `/home/kkourt/src/tests/make/subdir'
cp a a.copy
make[1]: Leaving directory `/home/kkourt/src/tests/make/subdir'
If I run make a second time, ./a gets updated
$ make
make -C subdir
make[1]: Entering directory `/home/kkourt/src/tests/make/subdir'
make[1]: `a.copy' is up to date.
make[1]: Leaving director
Why does this happen? shouldn't the check of whether subdir/a.copy is older than a.copy happen after the build_subdir target is finished since it's its dependency? Is there a way to fix this?
Edit:
As MadScientist suggested, I added a dummy recipe and it works:
subdir/a.copy: build_subdir
#:
Because your rule subdir/a.copy: build_subdir has no recipe, make "knows" that it can't actually change the timestamp on subdir/a.copy.
You need add a dummy recipe to it, maybe like this:
subdir/a.copy: build_subdir ;
(note I can't test this right now but I think it'll work).

Try to build tutorial for linux device driver

i am trying to learn how to write device driver on linux. I have looked at several online tutorials. They are simple enough but I have problem compiling it. I got a makefile error at the bottom. I have not done anything to the linux-header-2.6.32-27-generic. It is in the state that it was installed. It may be that it has some dependencies but I have no ideas which one. I am not sure what make is expecting.
I would appreciate any help.
Here is my system info.
Linux rat-desktop 2.6.32-27-generic #49-Ubuntu SMP Wed Dec 1 23:52:12 UTC 2010 i686 GNU/Linux
The include files are in /usr/src/linux-headers-2.6.32-27-generic
rat#rat-desktop:/usr/src/linux-headers-2.6.32-27-generic$ ls
arch firmware Kbuild modules.order security usr
block fs kernel Module.symvers sound virt
crypto include lib net source
Documentation init Makefile samples tools
drivers ipc mm scripts ubuntu
nothing.c
#include <linux/init.h>
#include <linux/module.h>
MODULE_LICENSE("Dual BSD/GPL");
static int __init hello_init(void)
{
printk(KERN_ALERT "Hello,world tapas\n");
return 0;
}
static void __exit hello_exit(void)
{
printk(KERN_ALERT "Good Bye,cruel world\n");
}
module_init(hello_init);
module_exit(hello_exit);
Makefile
obj-m := nothing.o
KDIR = /usr/src/linux-headers-2.6.32-27-generic
all:
$(MAKE) make -C $(KDIR) M=pwd modules
clean:
rm -rf *.o *.ko *.mo.* *.symvers *.order
sudo make
make make -C /usr/src/linux-headers-2.6.32-27-generic M=pwd modules
make[1]: Entering directory `/usr/src/linux-headers-2.6.32-27-generic'
make[1]: *** No rule to make target `make'. Stop.
make[1]: Leaving directory `/usr/src/linux-headers-2.6.32-27-generic'
make: *** [all] Error 2
I used another Makefile which got me a little more detail
obj-m += nothing.o
all:
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules
clean:
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean
rat#rat-desktop:~/deviceDrivers$ sudo make
make -C /lib/modules/2.6.32-27-generic/build M= modules
make[1]: Entering directory `/usr/src/linux-headers-2.6.32-27-generic'
CHK include/linux/version.h
CHK include/linux/utsrelease.h
SYMLINK include/asm -> include/asm-x86
make[2]: *** No rule to make target `kernel/bounds.c', needed by `kernel/bounds.s'. Stop.
make[1]: *** [prepare0] Error 2
make[1]: Leaving directory `/usr/src/linux-headers-2.6.32-27-generic'
make: *** [all] Error 2
In the first Makefile, observe the make command that is being executed in the output when you run sudo make (generally sudo is not required to build the modules) :
make make -C /usr/src/linux-headers-2.6.32-27-generic M=pwd modules
In this case, make is searching for a target named 'make'! Remove the $(MAKE) from the Makefile and try. And also M=pwd option is incorrect!
In the second case, the PWD variable isn't defined. You can define it in the Makefile something like this :
PWD := $(shell pwd)

build cross compiler mingw w64 gcc 4.8.2 on linux with winpthreads

I want to build a cross compiler mingw-w64 gcc in x86_64-unknown-linux-gnu to i686-w64-mingw32 with winphreads. From the document in the source package mingw-w64-v3.1.0/mingw-w64-doc, I know how to build cross gcc with win32 thread. However, I need to use c++11 thread, so I need to build cross gcc with posix thread. Moreover I know that mingw-w64 support posix thread in mingw-w64-v3.1.0/mingw-w64-libraries/winpthreads. Unfortunately, the above document does not explain how to build cross compiler mingw-w64 gcc.
Additional requirement, I need gcc, g++ gfortran and dwarf2 exception mode
As a result, I try the following procedure:
1 #!/bin/sh
2
3 threads=8
4
#build binutils
5 wget http://ftp.gnu.org/gnu/binutils/binutils-2.24.tar.bz2 -O - | tar -xj
6 cd binutils-2.24
7 mkdir build; cd $_
8 ../configure --prefix=$HOME/cross --with-sysroot=$HOME/cross --target=i686-w64-mingw32 --disable-multilib
9 make -j $threads; make check; make install-strip; cd ..; cd ..; rm -rf ~-
10
#install mingw-w64-headers
11 wget http://sourceforge.net/projects/mingw-w64/files/mingw-w64/mingw-w64-release/mingw-w64-v3.1.0.tar.bz2/download -O - | tar -xj
12 cd mingw-w64-v3.1.0/mingw-w64-headers
13 mkdir build; cd $_
14 ../configure --prefix=$HOME/cross/i686-w64-mingw32
15 make install; cd $HOME
16
17 ln -s $HOME/cross/i686-w64-mingw32 $HOME/cross/mingw
18
#build static gcc
19 wget http://www.netgull.com/gcc/releases/gcc-4.8.2/gcc-4.8.2.tar.bz2 -O - | tar -xj
20 cd gcc-4.8.2
21 mkdir build; cd $_
22 ../configure --prefix=$HOME/cross --with-sysroot=$HOME/cross --target=i686-w64-mingw32 --with-gmp=$HOME/gcc --with-mpfr=$HOME/gcc --with-mpc=$HOME/gcc --with-isl=$HOME/gcc --with-cloog=$HOME/gcc --enable-threads=posix --enable-checking=release --disable-multilib --enable-languages=c,c++,fortran --enable-__cxa_atexit --enable-dwarf2
23 make -j $threads all-gcc; make install-gcc
24
25 export PATH=$HOME/cross/bin:$PATH
26
#build mingw-w64-crt
27 cd $HOME/mingw-w64-v3.1.0/mingw-w64-crt
28 mkdir build; cd $_
29 ../configure --prefix=$HOME/cross/i686-w64-mingw32 --with-sysroot=$HOME/cross --host=i686-w64-mingw32
30 make -j $threads; make install-strip
31
#build winpthreads
32 cd $HOME/mingw-w64-v3.1.0/mingw-w64-libraries/winpthreads
33 mkdir build; cd $_
34 ../configure --prefix=$HOME/cross/i686-w64-mingw32 --with-sysroot=$HOME/cross --host=i686-w64-mingw32 --enable-shared=no
35 make -j $threads; make install-strip
36
#build full gcc
37 cd $HOME/gcc-4.8.2/build
38 make -j $threads; make check; make install-strip
However, when I do the last step build full gcc, I get the error as the following:
.libs/compatibility-atomic-c++0x.o: In function `_gthread_mutex_lock':
/home/cguo/gcc-4.8.2/build/i686-w64-mingw32/libstdc++-v3/include/i686-w64-mingw32/bits/gthr-default.h:748: undefined reference to `_imp__pthread_mutex_lock'
.libs/compatibility-atomic-c++0x.o: In function `_gthread_mutex_unlock':
/home/cguo/gcc-4.8.2/build/i686-w64-mingw32/libstdc++-v3/include/i686-w64-mingw32/bits/gthr-default.h:778: undefined reference to `_imp__pthread_mutex_unlock'
.libs/compatibility-atomic-c++0x.o: In function `_gthread_mutex_lock':
/home/cguo/gcc-4.8.2/build/i686-w64-mingw32/libstdc++-v3/include/i686-w64-mingw32/bits/gthr-default.h:748: undefined reference to `_imp__pthread_mutex_lock'
.libs/compatibility-atomic-c++0x.o: In function `_gthread_mutex_unlock':
/home/cguo/gcc-4.8.2/build/i686-w64-mingw32/libstdc++-v3/include/i686-w64-mingw32/bits/gthr-default.h:778: undefined reference to `_imp__pthread_mutex_unlock'
collect2: error: ld returned 1 exit status
make[5]: *** [libstdc++.la] Error 1
make[5]: Leaving directory `/home/cguo/gcc-4.8.2/build/i686-w64-mingw32/libstdc++-v3/src'
make[4]: *** [all-recursive] Error 1
make[4]: Leaving directory `/home/cguo/gcc-4.8.2/build/i686-w64-mingw32/libstdc++-v3/src'
make[3]: *** [all-recursive] Error 1
make[3]: Leaving directory `/home/cguo/gcc-4.8.2/build/i686-w64-mingw32/libstdc++-v3'
make[2]: *** [all] Error 2
make[2]: Leaving directory `/home/cguo/gcc-4.8.2/build/i686-w64-mingw32/libstdc++-v3'
make[1]: *** [all-target-libstdc++-v3] Error 2
make[1]: *** Waiting for unfinished jobs....
config.status: executing libtool commands
config.status: executing gstdint.h commands
make[1]: Leaving directory `/home/cguo/gcc-4.8.2/build'
make: *** [all] Error 2
So, how to fix the problem?
Thank you very much

How can I automatically create (and remove) a temp directory in a Makefile?

Is it possible to have make create a temp directory before it executes the first target? Maybe using some hack, some additional target etc.?
All commands in the Makefile would be able to refer to the automatically created directory as $TMPDIR, and the directory would be automatically removed when the make command ends.
These previous answers either didn't work or seemed overly complicated. Here is a far more straight forward example I was able to figure out:
PACKAGE := "audit"
all:
$(eval TMP := $(shell mktemp -d))
#mkdir $(TMP)/$(PACKAGE)
rm -rf $(TMP)
With GNU make, at least,
TMPDIR := $(shell mktemp -d)
will get you your temporary directory. I can't come up with a good way to clean it up at the end, other than the obvious rmdir "$(TMPDIR)" as part of the all target.
See Getting the name of the makefile from the makefile for the $(self) trick
ifeq ($(tmpdir),)
location = $(CURDIR)/$(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST))
self := $(location)
%:
#tmpdir=`mktemp --tmpdir -d`; \
trap 'rm -rf "$$tmpdir"' EXIT; \
$(MAKE) -f $(self) --no-print-directory tmpdir=$$tmpdir $#
else
# [your real Makefile]
%:
#echo Running target $# with $(tmpdir)
endif
I seem to recall being able to call make recursively, something along the lines of:
all:
-mkdir $(TEMPDIR)
$(MAKE) $(MFLAGS) old_all
-rm -rf $(TEMPDIR)
old_all: ... rest of stuff.
I've done similar tricks for calling make in subdirectories:
all:
#for i in $(SUBDIRS); do \
echo "make all in $$i..."; \
(cd $$i; $(MAKE) $(MFLAGS) all); \
done
Just checked it and this works fine:
$ cat Makefile
all:
-mkdir tempdir
-echo hello >tempdir/hello
-echo goodbye >tempdir/goodbye
$(MAKE) $(MFLAGS) old_all
-rm -rf tempdir
old_all:
ls -al tempdir
$ make all
mkdir tempdir
echo hello >tempdir/hello
echo goodbye >tempdir/goodbye
make old_all
make[1]: Entering directory '/home/pax'
ls -al tempdir
total 2
drwxr-xr-x+ 2 allachan None 0 Feb 26 15:00 .
drwxrwxrwx+ 4 allachan None 0 Feb 26 15:00 ..
-rw-r--r-- 1 allachan None 8 Feb 26 15:00 goodbye
-rw-r--r-- 1 allachan None 6 Feb 26 15:00 hello
make[1]: Leaving directory '/home/pax'
rm -rf tempdir
$ ls -al tempdir
ls: cannot access tempdir: No such file or directory

makefile calling makefile error

I have a working make, I have platform code and like several makes for each os in the folder. Right now I have one makefile which works. I renamed it to Makefile.ws and wrote this in Makefile
all:
make -f Makefile.w32
clean:
make -f Makefile.w32 clean
I ran it and got this error
> "make"
make -f Makefile.w32
make[1]: Entering directory `/c/nightly/test'
make -f Makefile.w32
make[3]: Makefile.w32: No such file or directory
make[3]: *** No rule to make target `Makefile.w32'. Stop.
make[2]: *** [all] Error 2
make[1]: *** [build] Error 2
make[1]: Leaving directory `/c/nightly/test'
"make": *** [all] Error 2
Oddly enough the clean works perfectly. Then I decided to write "make -f Makefile.w32 mingw32" and that did not work correctly. In fact it made a folder called mingw32 which I thought was very strange.
As for the mingw32 rule I just copy build which I suspect is the main/normal rule that is used to build
$(BUILD):
#[ -d $# ] || mkdir -p $#
#make --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile
mingw32:
#[ -d $# ] || mkdir -p $#
#make --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile
full .w32 source is here http://pastie.org/320035
First, what make are you running? Cygwin or MinGW, or something else?
make -f Makefile.w32
make[1]: Entering directory `/c/nightly/test'
make -f Makefile.w32
make[3]: Makefile.w32: No such file or directory
"Entering directory" is a hint. Why is it entering /c/nightly/test? Is there a Makefile.w32 there?
As to creating the directory "mingw32", the rule
mingw32:
#[ -d $# ] || mkdir -p $#
...
does exactly that. If "mingw32" does not exist, it creates it.
It would be easier to help you if you had a shorter example and clearly explain what you want to accomplish and what you expect to happen.
I think I see the problem in your second example. The mingw32 line should be changed so that it does not include the $(BUILD) variable:
mingw32:
#[ -d $# ] || mkdir -p $#
#make --no-print-directory -C mingw32 -f $(CURDIR)/Makefile
It is clear that he created the directory,
your first command in your given 2 rules, include a mkdir with the object name, i.e. either build or mingw32
Afterwards he changes into the current directory (i.e. no cd at all) and execute Makefile. But as you wrote you renamed Makefile into Makefile.ws, so offcourse you are getting File-Not-Found-error.
From the questions I can only recommend you to have a look at an short introduction or even better the manual for make.
Have you tried calling the secondary makefile using
$(MAKE) -f ...
instead of
make -f ...?

Resources