gnu-make

GCC build problem (#include_next limits.h)

末鹿安然 提交于 2019-11-30 16:52:34
问题 When i try to $ make depend -f gcc.mak a middleware on my Ubuntu machine I get this /usr/include/../include/limits.h:125:26: error: no include path in which to search for limits.h This is the contents around limits.h:125: /* Get the compiler's limits.h, which defines almost all the ISO constants. We put this #include_next outside the double inclusion check because it should be possible to include this file more than once and still get the definitions from gcc's header. */ #if defined __GNUC__

Error in make command makefile:18: *** missing separator. Stop

邮差的信 提交于 2019-11-30 16:50:21
For the following make file copied below, I am getting the missing separator error. Nothing seems to be wrong with the tabspace. OBJS = driver.o snapshot.o SHOBJS = malloc.o mymemory.o CC = g++ DEBUG = -g CFLAGS = -Wall -c $(DEBUG) LFLAGS = -Wall $(DEBUG) Snapshot: $(OBJS) $(CC) $(LFLAGS) $(OBJS) -o Snapshot driver.o: snapshot.h driver.cpp $(CC) $(CFLAGS) driver.cpp snapshot.o: mymemory.h snapshot.h snapshot.cpp $(CC) $(CFLAGS) snapshot.cpp libmymemory.so: $(SHOBJS) gcc -shared -o libmymemory.so malloc.o mymemory.o malloc.o: malloc.c gcc -fPIC -g -c -Wall malloc.c mymemory.o: mymemory.cpp gcc

Why is make printing “make: Nothing to be done for `all'.”?

这一生的挚爱 提交于 2019-11-30 14:04:40
问题 This is a "Hello.c" module and "Makefile". After executing make from the woking directory I get the following message: make: Nothing to be done for `all'. This is the "Hello.c" file: #include <linux/module.h> // included for all kernel modules #include <linux/kernel.h> // included for KERN_INFO #include <linux/init.h> // included for __init and __exit macros MODULE_LICENSE("GPL"); MODULE_AUTHOR("Lakshmanan"); MODULE_DESCRIPTION("A Simple Hello World module"); static int __init hello_init(void

How to check return value from the shell directive

老子叫甜甜 提交于 2019-11-30 13:44:18
问题 In my Makefile, I need to test if the current directory is an SVN repo or not and if it is not I want to indicate an error using the $(error) directive in Makefile. So I plan to use the return value of $(shell svn info .) but I'm not sure how to get this value from within the Makefile. Note: I'm not trying to get the return value in a recipe, but rather in the middle of the Makefile. Right now I'm doing something like this, which works just because stdout is blank when it is an error: SVN

How to use GNU make --max-load on a multicore Linux machine?

生来就可爱ヽ(ⅴ<●) 提交于 2019-11-30 12:30:19
From the documentation for GNU make: http://www.gnu.org/software/make/manual/make.html#Parallel When the system is heavily loaded, you will probably want to run fewer jobs than when it is lightly loaded. You can use the ‘-l’ option to tell make to limit the number of jobs to run at once, based on the load average. The ‘-l’ or ‘--max-load’ option is followed by a floating-point number. For example, -l 2.5 will not let make start more than one job if the load average is above 2.5. The ‘-l’ option with no following number removes the load limit, if one was given with a previous ‘-l’ option. More

Suppress and ignore output for Makefile?

亡梦爱人 提交于 2019-11-30 11:37:32
问题 I know that the @ prefix suppresses output from a shell command in Makefiles, and also that the - prefix will ignore errors from a shell command. Is there a way to combine the two, i.e. a prefix that suppresses output and ignores errors? I don't think @- or -@ works. 回答1: Actually, @- and -@ both do work, but will print a make: [target] Error 1 (ignored) warning. Instead, you can use @command || true or, since : is shorthand for true in shell, @command ||: This often a better thing to do,

How to specify RPATH in a makefile?

淺唱寂寞╮ 提交于 2019-11-30 11:06:37
问题 I'm trying to specify rpath in my binary. My makefile looks like this- CC=gcc CFLAGS=-Wall LDFLAGS= -rpath='../libs/' main: main.c gcc -o main main.c clean: rm -f main main.o But when I query rpath using command readelf -a ./main | grep rpath I get nothing I've tried specifying rpath as LDFLAGS= "-rpath=../libs/" but even that doesn't seem to work. Can someone please post an example on how should I specify rpath in a makefile? GCC and ld versions are- gcc (Ubuntu/Linaro 4.5.2-8ubuntu4) 4.5.2

How can I configure my makefile for debug and release builds?

帅比萌擦擦* 提交于 2019-11-30 10:03:09
问题 I have the following makefile for my project, and I'd like to configure it for release and debug builds. In my code, I have lots of #ifdef DEBUG macros in place, so it's simply a matter of setting this macro and adding the -g3 -gdwarf2 flags to the compilers. How can I do this? $(CC) = g++ -g3 -gdwarf2 $(cc) = gcc -g3 -gdwarf2 all: executable executable: CommandParser.tab.o CommandParser.yy.o Command.o g++ -g -o output CommandParser.yy.o CommandParser.tab.o Command.o -lfl CommandParser.yy.o:

Why is make printing “make: Nothing to be done for `all'.”?

白昼怎懂夜的黑 提交于 2019-11-30 09:46:47
This is a "Hello.c" module and "Makefile". After executing make from the woking directory I get the following message: make: Nothing to be done for `all'. This is the "Hello.c" file: #include <linux/module.h> // included for all kernel modules #include <linux/kernel.h> // included for KERN_INFO #include <linux/init.h> // included for __init and __exit macros MODULE_LICENSE("GPL"); MODULE_AUTHOR("Lakshmanan"); MODULE_DESCRIPTION("A Simple Hello World module"); static int __init hello_init(void) { printk(KERN_INFO "Hello world!\n"); return 0; // Non-zero return means that the module couldn't be

get a default value when variable is unset in make

泄露秘密 提交于 2019-11-30 08:58:37
(edit: question more accurate based on @Michael feedback) In bash, I often use parameter expansion : the following commands print " default value " when $VARNAME is unset, otherwise it prints the VARNAME content. echo ${VARNAME:-default value} #if VARNAME empty => print "default value" echo ${VARNAME-default value} #if VARNAME empty => print "" (VARNAME string) I did not find a similar feature on GNU make . I finally wrote in my Makefile : VARNAME ?= "default value" all: echo ${VARNAME} But I am not happy with this solution: it always creates the variable VARNAME and this may change the