[1] http://www.gnu.org/software/make/manual/make.html#Running
9 How to Run make
A makefile that says how to recompile a program can be used in more than one way. The simplest use is to recompile every file that is out of date. Usually, makefiles are written so that if you run make with no arguments, it does just that.
But you might want to update only some of the files; you might want to use a different compiler or different compiler options; you might want just to find out which files are out of date without changing them.
By giving arguments when you run make, you can do any of these things and many others.
Showing posts with label GNU Make. Show all posts
Showing posts with label GNU Make. Show all posts
Thursday, October 14, 2010
Save GNU make result into a text file - divert output
$make 2>&1 | tee build-log.txt
Sunday, July 25, 2010
Make file in GCC
missing separator. Stop.
-------------------------------
From: http://www.delorie.com/djgpp/v2faq/faq22_17.html
Q: When I invoke Make, it refuses to do anything and prints a cryptic message: "makefile:10: *** missing separator. Stop." Now what kind of excuse is that?
A: Unlike most other DOS Make programs which accept any whitespace character at the beginning of a command in a rule, GNU Make insists that every such line begins with a TAB. (Most other Unix Make programs also require TABs, and the Posix standard requires it as well.) Make sure that the line whose number is printed in the error message (in this case, line 10) begins with a TAB.
Hello world sample using make file
-------------------------------------
[q.yang@localhost Gsn_HelloEclipse]$ pwd
/home/q.yang/lpc3250/ltib-qs/rootfs/home/user/Gsn_HelloEclipse
[q.yang@localhost Gsn_HelloEclipse]$ tree
[q.yang@localhost Gsn_HelloEclipse]$ cat Makefile
[q.yang@localhost Gsn_HelloEclipse]$ cat ./sources/Makefile
[q.yang@localhost Gsn_HelloEclipse]$ cat ./sources/hellocpp.cpp
[q.yang@localhost Gsn_HelloEclipse]$ make
[q.yang@localhost Gsn_HelloEclipse]$ tree
[q.yang@localhost Gsn_HelloEclipse]$ make clean
[q.yang@localhost Gsn_HelloEclipse]$ tree
-------------------------------
From: http://www.delorie.com/djgpp/v2faq/faq22_17.html
Q: When I invoke Make, it refuses to do anything and prints a cryptic message: "makefile:10: *** missing separator. Stop." Now what kind of excuse is that?
A: Unlike most other DOS Make programs which accept any whitespace character at the beginning of a command in a rule, GNU Make insists that every such line begins with a TAB. (Most other Unix Make programs also require TABs, and the Posix standard requires it as well.) Make sure that the line whose number is printed in the error message (in this case, line 10) begins with a TAB.
Hello world sample using make file
-------------------------------------
[q.yang@localhost Gsn_HelloEclipse]$ pwd
/home/q.yang/lpc3250/ltib-qs/rootfs/home/user/Gsn_HelloEclipse
[q.yang@localhost Gsn_HelloEclipse]$ tree
.
|-- Makefile
|-- debug
|-- include
`-- sources
|-- Makefile
`-- hellocpp.cpp
[q.yang@localhost Gsn_HelloEclipse]$ cat Makefile
all:
make -C sources
mv ./sources/*.o ./debug
mv ./sources/hellocpp ./debug
clean:
rm -f ./debug/*.o
rm -f ./debug/hellocpp
[q.yang@localhost Gsn_HelloEclipse]$ cat ./sources/Makefile
OBJS = hellocpp.o
CC = arm-none-linux-gnueabi-g++
DEBUG = -g
CFLAGS = -Wall -c $(DEBUG)
LFLAGS = -Wall $(DEBUG)
INCL = -I. -I../ -I../Include
all:hellocpp
hellocpp: $(OBJS)
$(CC) -o hellocpp $(OBJS)
%.o: %.cpp
$(CC) -c $(CFLAGS) $(INCL) $< -o $@
[q.yang@localhost Gsn_HelloEclipse]$ cat ./sources/hellocpp.cpp
#include
using namespace std;
int main()
{
cout << "Hello world!" << endl;
cout << "Hello there. First GsnCpp from Eclipse IDE.\n";
return 0;
}
[q.yang@localhost Gsn_HelloEclipse]$ make
make -C sources
make[1]: Entering directory `/home/q.yang/lpc3250/ltib-qs/rootfs/home/user/Gsn_HelloEclipse/sources'
arm-none-linux-gnueabi-g++ -c -Wall -c -g -I. -I../ -I../Include hellocpp.cpp -o hellocpp.o
arm-none-linux-gnueabi-g++ -o hellocpp hellocpp.o
make[1]: Leaving directory `/home/q.yang/lpc3250/ltib-qs/rootfs/home/user/Gsn_HelloEclipse/sources'
mv ./sources/*.o ./debug
mv ./sources/hellocpp ./debug
[q.yang@localhost Gsn_HelloEclipse]$ tree
.
|-- Makefile
|-- debug
| |-- hellocpp
| `-- hellocpp.o
|-- include
`-- sources
|-- Makefile
`-- hellocpp.cpp
[q.yang@localhost Gsn_HelloEclipse]$ make clean
rm -f ./debug/*.o
rm -f ./debug/hellocpp
[q.yang@localhost Gsn_HelloEclipse]$ tree
.
|-- Makefile
|-- debug
|-- include
`-- sources
|-- Makefile
`-- hellocpp.cpp
Subscribe to:
Posts (Atom)