1b462fcd5SAlexander Grafall: build-all 2b462fcd5SAlexander Graf# Dummy command so that make thinks it has done something 3b462fcd5SAlexander Graf @true 4b462fcd5SAlexander Graf 59ffed426SPaolo Bonziniinclude config-host.mak 649b7d744SPaolo BonziniCFLAGS = -O2 -g 79ffed426SPaolo BonziniMAKEFLAGS += -rR 8b462fcd5SAlexander Graf 9*ebc1d821SPaolo BonziniNULL := 10*ebc1d821SPaolo BonziniSPACE := $(NULL) # 11*ebc1d821SPaolo BonziniTARGET_PREFIX := $(patsubst %/,%:$(SPACE),$(TARGET_DIR)) 12*ebc1d821SPaolo Bonzini 13*ebc1d821SPaolo Bonziniquiet-@ = $(if $(V),,@) 1422fb2ab0SThomas Huthquiet-command = $(if $(V),$1,$(if $(2),@printf " %-7s %s\n" $2 $3 && $1, @$1)) 1522fb2ab0SThomas Huth 1622fb2ab0SThomas HuthVPATH_SUFFIXES = %.c %.h %.S %.m %.mak %.sh %.rc Kconfig% %.json.in 1722fb2ab0SThomas Huthset-vpath = $(if $1,$(foreach PATTERN,$(VPATH_SUFFIXES),$(eval vpath $(PATTERN) $1))) 189ffed426SPaolo Bonzini$(call set-vpath, $(SRC_PATH)) 19b462fcd5SAlexander Graf 2022fb2ab0SThomas Huth# Flags for dependency generation 2122fb2ab0SThomas HuthQEMU_DGFLAGS = -MMD -MP -MT $@ -MF $(@D)/$(*F).d 2222fb2ab0SThomas Huth 2322fb2ab0SThomas Huth%.o: %.c 2475b24479SPaolo Bonzini $(call quiet-command,$(CC) $(EXTRA_CFLAGS) $(QEMU_DGFLAGS) $(CFLAGS) \ 2522fb2ab0SThomas Huth -c -o $@ $<,"CC","$(TARGET_DIR)$@") 2622fb2ab0SThomas Huth 2722fb2ab0SThomas Huth%.o: %.S 2875b24479SPaolo Bonzini $(call quiet-command,$(CCAS) $(EXTRA_CFLAGS) $(QEMU_DGFLAGS) $(CFLAGS) \ 2922fb2ab0SThomas Huth -c -o $@ $<,"CCAS","$(TARGET_DIR)$@") 3022fb2ab0SThomas Huth 31*ebc1d821SPaolo Bonzini.PHONY : all clean build-all distclean 32b462fcd5SAlexander Graf 339a848adfSThomas HuthOBJECTS = start.o main.o bootmap.o jump2ipl.o sclp.o menu.o \ 34efa47d36SJason J. Herne virtio.o virtio-scsi.o virtio-blkdev.o libc.o cio.o dasd-ipl.o 359a848adfSThomas Huth 36*ebc1d821SPaolo BonziniEXTRA_CFLAGS += -Wall 3775b24479SPaolo BonziniEXTRA_CFLAGS += -ffreestanding -fno-delete-null-pointer-checks -fno-common -fPIE 3875b24479SPaolo BonziniEXTRA_CFLAGS += -fwrapv -fno-strict-aliasing -fno-asynchronous-unwind-tables 3975b24479SPaolo BonziniEXTRA_CFLAGS += -msoft-float 4075b24479SPaolo BonziniEXTRA_CFLAGS += -std=gnu99 41d884c86dSThomas HuthLDFLAGS += -Wl,-pie -nostdlib 42b462fcd5SAlexander Graf 43*ebc1d821SPaolo Bonzinicc-test = $(CC) -Werror $1 -c -o /dev/null -xc /dev/null >/dev/null 2>/dev/null 44*ebc1d821SPaolo Bonzinicc-option = if $(call cc-test, $1); then \ 45*ebc1d821SPaolo Bonzini echo "$(TARGET_PREFIX)$1 detected" && echo "EXTRA_CFLAGS += $1" >&3; else \ 46*ebc1d821SPaolo Bonzini echo "$(TARGET_PREFIX)$1 not detected" $(if $2,&& echo "EXTRA_CFLAGS += $2" >&3); fi 47*ebc1d821SPaolo Bonzini 48*ebc1d821SPaolo Bonziniconfig-cc.mak: Makefile 49*ebc1d821SPaolo Bonzini $(quiet-@)($(call cc-option,-Wno-stringop-overflow); \ 50*ebc1d821SPaolo Bonzini $(call cc-option,-fno-stack-protector); \ 51*ebc1d821SPaolo Bonzini $(call cc-option,-Wno-array-bounds); \ 52*ebc1d821SPaolo Bonzini $(call cc-option,-Wno-gnu); \ 53*ebc1d821SPaolo Bonzini $(call cc-option,-march=z900,-march=z10)) 3> config-cc.mak 54*ebc1d821SPaolo Bonzini-include config-cc.mak 55*ebc1d821SPaolo Bonzini 56*ebc1d821SPaolo BonziniLDFLAGS += -Wl,-pie -nostdlib 57*ebc1d821SPaolo Bonzini 583e4415a7SThomas Huthbuild-all: s390-ccw.img s390-netboot.img 59b462fcd5SAlexander Graf 60b462fcd5SAlexander Grafs390-ccw.elf: $(OBJECTS) 610bdb12c7SPeter Maydell $(call quiet-command,$(CC) $(LDFLAGS) -o $@ $(OBJECTS),"BUILD","$(TARGET_DIR)$@") 62b462fcd5SAlexander Graf 63b462fcd5SAlexander Grafs390-ccw.img: s390-ccw.elf 64c68f4503SGreg Kurz $(call quiet-command,$(STRIP) --strip-unneeded $< -o $@,"STRIP","$(TARGET_DIR)$@") 65d884c86dSThomas Huth 66d884c86dSThomas Huth$(OBJECTS): Makefile 67b462fcd5SAlexander Graf 689ffed426SPaolo Bonziniifneq ($(wildcard $(SRC_PATH)/../../roms/SLOF/lib/libnet),) 699ffed426SPaolo Bonziniinclude $(SRC_PATH)/netboot.mak 703e4415a7SThomas Huthelse 713e4415a7SThomas Huths390-netboot.img: 723e4415a7SThomas Huth @echo "s390-netboot.img not built since roms/SLOF/ is not available." 733e4415a7SThomas Huthendif 743e4415a7SThomas Huth 751c9f6550SThomas HuthALL_OBJS = $(sort $(OBJECTS) $(NETOBJS) $(LIBCOBJS) $(LIBNETOBJS)) 761c9f6550SThomas Huth-include $(ALL_OBJS:%.o=%.d) 771c9f6550SThomas Huth 78b462fcd5SAlexander Grafclean: 7988b3739aSEric Farman rm -f *.o *.d *.img *.elf *~ *.a 80*ebc1d821SPaolo Bonzini 81*ebc1d821SPaolo Bonzinidistclean: 82*ebc1d821SPaolo Bonzini rm -f config-cc.mak 83