aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Maydell <pmaydell@chiark.greenend.org.uk>2017-02-15 16:24:23 +0000
committerPeter Maydell <peter.maydell@linaro.org>2017-02-24 16:37:32 +0000
commit401db915be9b2baaed58456346baf80899fc127a (patch)
treef436322c83b15657d9346b43c1eb080cc7a39682
parent21911c0cc9b32eae6f1d28261f64de168dbdfceb (diff)
Makefile: Build with -D_GNU_SOURCE=1
For x86 the ucontext.h only provides the #defines for register indexes if _GNU_SOURCE is enabled; enable it. As part of this, split our CFLAGS into: * CFLAGS: can be set by the user, defaults to -g * EXTRA_CFLAGS: set by the user, additional to CFLAGS * ALL_CFLAGS: the above, plus flags we must have in order to build correctly (or otherwise don't want the user to disable) Signed-off-by: Peter Maydell <pmaydell@chiark.greenend.org.uk>
-rw-r--r--Makefile8
1 files changed, 5 insertions, 3 deletions
diff --git a/Makefile b/Makefile
index 9012a8c..d20c4e4 100644
--- a/Makefile
+++ b/Makefile
@@ -15,7 +15,9 @@ include Makefile.in
VPATH=$(SRCDIR)
-CFLAGS ?= -g -Wall
+CFLAGS ?= -g
+
+ALL_CFLAGS = -Wall -D_GNU_SOURCE $(CFLAGS) $(EXTRA_CFLAGS)
PROG=risu
SRCS=risu.c comms.c risu_$(ARCH).c risu_reginfo_$(ARCH).c
@@ -33,13 +35,13 @@ all: $(PROG) $(BINS)
dump: $(RISU_ASMS)
$(PROG): $(OBJS)
- $(CC) $(STATIC) $(CFLAGS) -o $@ $^
+ $(CC) $(STATIC) $(ALL_CFLAGS) -o $@ $^
%.risu.asm: %.risu.bin
${OBJDUMP} -b binary -m $(ARCH) -D $^ > $@
%.o: %.c $(HDRS)
- $(CC) $(CPPFLAGS) $(CFLAGS) -o $@ -c $<
+ $(CC) $(CPPFLAGS) $(ALL_CFLAGS) -o $@ -c $<
%_$(ARCH).bin: %_$(ARCH).elf
$(OBJCOPY) -O binary $< $@