meson: target
[qemu/ar7.git] / pc-bios / s390-ccw / Makefile
blobcc0f77baa67ed759a212c6dae399148abf712ce4
1 all: build-all
2 # Dummy command so that make thinks it has done something
3 @true
5 include ../../config-host.mak
7 quiet-command = $(if $(V),$1,$(if $(2),@printf " %-7s %s\n" $2 $3 && $1, @$1))
8 cc-option = $(if $(shell $(CC) $1 -S -o /dev/null -xc /dev/null > /dev/null \
9 2>&1 && echo OK), $1, $2)
11 VPATH_SUFFIXES = %.c %.h %.S %.m %.mak %.sh %.rc Kconfig% %.json.in
12 set-vpath = $(if $1,$(foreach PATTERN,$(VPATH_SUFFIXES),$(eval vpath $(PATTERN) $1)))
13 $(call set-vpath, $(SRC_PATH)/pc-bios/s390-ccw)
15 # Flags for dependency generation
16 QEMU_DGFLAGS = -MMD -MP -MT $@ -MF $(@D)/$(*F).d
18 %.o: %.c
19 $(call quiet-command,$(CC) $(QEMU_CFLAGS) $(QEMU_DGFLAGS) $(CFLAGS) \
20 -c -o $@ $<,"CC","$(TARGET_DIR)$@")
22 %.o: %.S
23 $(call quiet-command,$(CCAS) $(QEMU_CFLAGS) $(QEMU_DGFLAGS) $(CFLAGS) \
24 -c -o $@ $<,"CCAS","$(TARGET_DIR)$@")
26 .PHONY : all clean build-all
28 OBJECTS = start.o main.o bootmap.o jump2ipl.o sclp.o menu.o \
29 virtio.o virtio-scsi.o virtio-blkdev.o libc.o cio.o dasd-ipl.o
31 QEMU_CFLAGS := $(filter -W%, $(QEMU_CFLAGS))
32 QEMU_CFLAGS += -ffreestanding -fno-delete-null-pointer-checks -msoft-float
33 QEMU_CFLAGS += -march=z900 -fPIE -fno-strict-aliasing
34 QEMU_CFLAGS += -fno-asynchronous-unwind-tables
35 QEMU_CFLAGS += $(call cc-option, $(QEMU_CFLAGS), -fno-stack-protector)
36 LDFLAGS += -Wl,-pie -nostdlib
38 build-all: s390-ccw.img s390-netboot.img
40 s390-ccw.elf: $(OBJECTS)
41 $(call quiet-command,$(CC) $(LDFLAGS) -o $@ $(OBJECTS),"BUILD","$(TARGET_DIR)$@")
43 STRIP ?= strip
45 s390-ccw.img: s390-ccw.elf
46 $(call quiet-command,$(STRIP) --strip-unneeded $< -o $@,"STRIP","$(TARGET_DIR)$@")
48 $(OBJECTS): Makefile
50 ifneq ($(wildcard $(SRC_PATH)/roms/SLOF/lib/libnet),)
51 include $(SRC_PATH)/pc-bios/s390-ccw/netboot.mak
52 else
53 s390-netboot.img:
54 @echo "s390-netboot.img not built since roms/SLOF/ is not available."
55 endif
57 ALL_OBJS = $(sort $(OBJECTS) $(NETOBJS) $(LIBCOBJS) $(LIBNETOBJS))
58 -include $(ALL_OBJS:%.o=%.d)
60 clean:
61 rm -f *.o *.d *.img *.elf *~ *.a