I'm trying to build a file using gcc. It includes mutex.h.
Makefile:
CC = gcc
CFLAGS = -I/usr/src/linux-headers-3.13.0-32/include
CFLAGS += -I/usr/src/linux-headers-3.13.0-32/arch/x86/include
SOURCES := $(wildcard *.c)
all: $(SOURCES)
$(CC) $(CFLAGS) $(SOURCES)
When I give make, I'm getting the following errors.
Error:
gcc -I/usr/src/linux-headers-3.13.0-32/include -I/usr/src/linux-headers-3.13.0-32/arch/x86/include app.c rtos.c
In file included from /usr/src/linux-headers-3.13.0-32/include/linux/bitops.h:33:0,
from /usr/src/linux-headers-3.13.0-32/include/linux/kernel.h:10,
from /usr/src/linux-headers-3.13.0-32/arch/x86/include/asm/percpu.h:44,
from /usr/src/linux-headers-3.13.0-32/arch/x86/include/asm/current.h:5,
from /usr/src/linux-headers-3.13.0-32/include/linux/mutex.h:13,
from rtos.c:55:
/usr/src/linux-headers-3.13.0-32/arch/x86/include/asm/bitops.h:70:24: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘void’
/usr/src/linux-headers-3.13.0-32/arch/x86/include/asm/bitops.h:108:24: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘void’
/usr/src/linux-headers-3.13.0-32/arch/x86/include/asm/bitops.h:218:24: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘int’
/usr/src/linux-headers-3.13.0-32/arch/x86/include/asm/bitops.h:310:24: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘int’
The line 218 in /usr/src/linux-headers-3.13.0-32/arch/x86/include/asm/bitops.h, that shows error is the first line of the below code snippet.
static __always_inline int
test_and_set_bit_lock(long nr, volatile unsigned long *addr)
{
return test_and_set_bit(nr, addr);
}
I don't find anything incorrect with this type of function definition.
Please give me some pointers if I'm missing something in my Makefile.