xref: /openbmc/qemu/pc-bios/s390-ccw/Makefile (revision 49b7d744)
1b462fcd5SAlexander Grafall: build-all
2b462fcd5SAlexander Graf# Dummy command so that make thinks it has done something
3b462fcd5SAlexander Graf	@true
4b462fcd5SAlexander Graf
5b462fcd5SAlexander Grafinclude ../../config-host.mak
6*49b7d744SPaolo BonziniCFLAGS = -O2 -g
7b462fcd5SAlexander Graf
822fb2ab0SThomas Huthquiet-command = $(if $(V),$1,$(if $(2),@printf "  %-7s %s\n" $2 $3 && $1, @$1))
922fb2ab0SThomas Huthcc-option = $(if $(shell $(CC) $1 -S -o /dev/null -xc /dev/null > /dev/null \
1022fb2ab0SThomas Huth	      2>&1 && echo OK), $1, $2)
1122fb2ab0SThomas Huth
1222fb2ab0SThomas HuthVPATH_SUFFIXES = %.c %.h %.S %.m %.mak %.sh %.rc Kconfig% %.json.in
1322fb2ab0SThomas Huthset-vpath = $(if $1,$(foreach PATTERN,$(VPATH_SUFFIXES),$(eval vpath $(PATTERN) $1)))
14b462fcd5SAlexander Graf$(call set-vpath, $(SRC_PATH)/pc-bios/s390-ccw)
15b462fcd5SAlexander Graf
1622fb2ab0SThomas Huth# Flags for dependency generation
1722fb2ab0SThomas HuthQEMU_DGFLAGS = -MMD -MP -MT $@ -MF $(@D)/$(*F).d
1822fb2ab0SThomas Huth
1922fb2ab0SThomas Huth%.o: %.c
2022fb2ab0SThomas Huth	$(call quiet-command,$(CC) $(QEMU_CFLAGS) $(QEMU_DGFLAGS) $(CFLAGS) \
2122fb2ab0SThomas Huth	       -c -o $@ $<,"CC","$(TARGET_DIR)$@")
2222fb2ab0SThomas Huth
2322fb2ab0SThomas Huth%.o: %.S
2422fb2ab0SThomas Huth	$(call quiet-command,$(CCAS) $(QEMU_CFLAGS) $(QEMU_DGFLAGS) $(CFLAGS) \
2522fb2ab0SThomas Huth	       -c -o $@ $<,"CCAS","$(TARGET_DIR)$@")
2622fb2ab0SThomas Huth
27b462fcd5SAlexander Graf.PHONY : all clean build-all
28b462fcd5SAlexander Graf
299a848adfSThomas HuthOBJECTS = start.o main.o bootmap.o jump2ipl.o sclp.o menu.o \
30efa47d36SJason J. Herne	  virtio.o virtio-scsi.o virtio-blkdev.o libc.o cio.o dasd-ipl.o
319a848adfSThomas Huth
32*49b7d744SPaolo BonziniQEMU_CFLAGS := -Wall $(filter -W%, $(QEMU_CFLAGS))
33c86c03cfSChristian BorntraegerQEMU_CFLAGS += -ffreestanding -fno-delete-null-pointer-checks -msoft-float
34c86c03cfSChristian BorntraegerQEMU_CFLAGS += -march=z900 -fPIE -fno-strict-aliasing
3563c93facSThomas HuthQEMU_CFLAGS += -fno-asynchronous-unwind-tables
36c86c03cfSChristian BorntraegerQEMU_CFLAGS += $(call cc-option, $(QEMU_CFLAGS), -fno-stack-protector)
37d884c86dSThomas HuthLDFLAGS += -Wl,-pie -nostdlib
38b462fcd5SAlexander Graf
393e4415a7SThomas Huthbuild-all: s390-ccw.img s390-netboot.img
40b462fcd5SAlexander Graf
41b462fcd5SAlexander Grafs390-ccw.elf: $(OBJECTS)
420bdb12c7SPeter Maydell	$(call quiet-command,$(CC) $(LDFLAGS) -o $@ $(OBJECTS),"BUILD","$(TARGET_DIR)$@")
43b462fcd5SAlexander Graf
44c68f4503SGreg KurzSTRIP ?= strip
45c68f4503SGreg Kurz
46b462fcd5SAlexander Grafs390-ccw.img: s390-ccw.elf
47c68f4503SGreg Kurz	$(call quiet-command,$(STRIP) --strip-unneeded $< -o $@,"STRIP","$(TARGET_DIR)$@")
48d884c86dSThomas Huth
49d884c86dSThomas Huth$(OBJECTS): Makefile
50b462fcd5SAlexander Graf
513e4415a7SThomas Huthifneq ($(wildcard $(SRC_PATH)/roms/SLOF/lib/libnet),)
523e4415a7SThomas Huthinclude $(SRC_PATH)/pc-bios/s390-ccw/netboot.mak
533e4415a7SThomas Huthelse
543e4415a7SThomas Huths390-netboot.img:
553e4415a7SThomas Huth	@echo "s390-netboot.img not built since roms/SLOF/ is not available."
563e4415a7SThomas Huthendif
573e4415a7SThomas Huth
581c9f6550SThomas HuthALL_OBJS = $(sort $(OBJECTS) $(NETOBJS) $(LIBCOBJS) $(LIBNETOBJS))
591c9f6550SThomas Huth-include $(ALL_OBJS:%.o=%.d)
601c9f6550SThomas Huth
61b462fcd5SAlexander Grafclean:
6288b3739aSEric Farman	rm -f *.o *.d *.img *.elf *~ *.a
63