1XEN_ROOT = $(CURDIR)/../../..
2CFLAGS :=
3include $(XEN_ROOT)/tools/Rules.mk
4
5$(call cc-options-add,CFLAGS,CC,$(EMBEDDED_EXTRA_CFLAGS))
6
7CFLAGS += -ffreestanding -nostdinc -I$(XEN_ROOT)/tools/firmware/include
8CFLAGS += -fno-stack-protector -g0 $($(TESTCASE)-cflags)
9
10LDFLAGS_DIRECT += $(shell { $(LD) -v --warn-rwx-segments; } >/dev/null 2>&1 && echo --no-warn-rwx-segments)
11
12.PHONY: all
13all: $(TESTCASE).bin
14
15%.bin: %.c
16	$(CC) $(filter-out -M% .%,$(CFLAGS)) -c $<
17	$(LD) $(LDFLAGS_DIRECT) -N -Ttext 0x100000 -o $*.tmp $*.o
18	$(OBJCOPY) -O binary -R .note.gnu.property $*.tmp $@
19	rm -f $*.tmp
20
21%-opmask.bin: opmask.S
22	$(CC) $(filter-out -M% .%,$(CFLAGS)) -c $< -o $(basename $@).o
23	$(LD) $(LDFLAGS_DIRECT) -N -Ttext 0x100000 -o $(basename $@).tmp $(basename $@).o
24	$(OBJCOPY) -O binary -R .note.gnu.property $(basename $@).tmp $@
25	rm -f $(basename $@).tmp
26