1override XEN_TARGET_ARCH=x86_32
2CFLAGS =
3include $(XEN_ROOT)/Config.mk
4
5$(call cc-options-add,CFLAGS,CC,$(EMBEDDED_EXTRA_CFLAGS))
6
7CFLAGS += -Werror -fno-asynchronous-unwind-tables -fno-builtin -g0 -msoft-float
8CFLAGS += -I$(XEN_ROOT)/xen/include
9CFLAGS := $(filter-out -flto,$(CFLAGS))
10
11# NB. awk invocation is a portable alternative to 'head -n -1'
12%.S: %.bin
13	(od -v -t x $< | tr -s ' ' | awk 'NR > 1 {print s} {s=$$0}' | \
14	sed 's/ /,0x/g' | sed 's/,0x$$//' | sed 's/^[0-9]*,/ .long /') >$@
15
16# Drop .got.plt during conversion to plain binary format.
17# Please check build32.lds for more details.
18%.bin: %.lnk
19	$(OBJDUMP) -h $< | sed -n '/[0-9]/{s,00*,0,g;p;}' | \
20		while read idx name sz rest; do \
21			case "$$name" in \
22			.got.plt) \
23				test $$sz != 0c || continue; \
24				echo "Error: non-empty $$name: 0x$$sz" >&2; \
25				exit $$(expr $$idx + 1);; \
26			esac; \
27		done
28	$(OBJCOPY) -O binary -R .got.plt $< $@
29
30%.lnk: %.o
31	$(LD) $(LDFLAGS_DIRECT) -N -T build32.lds -o $@ $<
32
33%.o: %.c
34	$(CC) $(CFLAGS) -c -fpic $< -o $@
35
36cmdline.o: cmdline.c $(CMDLINE_DEPS)
37
38reloc.o: reloc.c $(RELOC_DEPS)
39
40.PRECIOUS: %.bin %.lnk
41