xref: /openbmc/qemu/pc-bios/s390-ccw/Makefile (revision e3e2708f)
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
9b11f9bd9SPaolo BonziniGIT_SUBMODULES = roms/SLOF
10b11f9bd9SPaolo Bonzini
11ebc1d821SPaolo BonziniNULL :=
12ebc1d821SPaolo BonziniSPACE := $(NULL) #
13ebc1d821SPaolo BonziniTARGET_PREFIX := $(patsubst %/,%:$(SPACE),$(TARGET_DIR))
14ebc1d821SPaolo Bonzini
15b5fc8458SPaolo Bonziniquiet-@ = $(if $(V),,@$(if $1,printf "%s\n" "$(TARGET_PREFIX)$1" && ))
16b5fc8458SPaolo Bonziniquiet-command = $(call quiet-@,$2 $@)$1
1722fb2ab0SThomas Huth
1822fb2ab0SThomas HuthVPATH_SUFFIXES = %.c %.h %.S %.m %.mak %.sh %.rc Kconfig% %.json.in
1922fb2ab0SThomas Huthset-vpath = $(if $1,$(foreach PATTERN,$(VPATH_SUFFIXES),$(eval vpath $(PATTERN) $1)))
209ffed426SPaolo Bonzini$(call set-vpath, $(SRC_PATH))
21b462fcd5SAlexander Graf
2222fb2ab0SThomas Huth# Flags for dependency generation
2322fb2ab0SThomas HuthQEMU_DGFLAGS = -MMD -MP -MT $@ -MF $(@D)/$(*F).d
2422fb2ab0SThomas Huth
2522fb2ab0SThomas Huth%.o: %.c
2675b24479SPaolo Bonzini	$(call quiet-command,$(CC) $(EXTRA_CFLAGS) $(QEMU_DGFLAGS) $(CFLAGS) \
27b5fc8458SPaolo Bonzini	       -c -o $@ $<,Compiling)
2822fb2ab0SThomas Huth
2922fb2ab0SThomas Huth%.o: %.S
3075b24479SPaolo Bonzini	$(call quiet-command,$(CCAS) $(EXTRA_CFLAGS) $(QEMU_DGFLAGS) $(CFLAGS) \
31b5fc8458SPaolo Bonzini	       -c -o $@ $<,Assembling)
3222fb2ab0SThomas Huth
33ebc1d821SPaolo Bonzini.PHONY : all clean build-all distclean
34b462fcd5SAlexander Graf
359a848adfSThomas HuthOBJECTS = start.o main.o bootmap.o jump2ipl.o sclp.o menu.o \
36efa47d36SJason J. Herne	  virtio.o virtio-scsi.o virtio-blkdev.o libc.o cio.o dasd-ipl.o
379a848adfSThomas Huth
38ebc1d821SPaolo BonziniEXTRA_CFLAGS += -Wall
3975b24479SPaolo BonziniEXTRA_CFLAGS += -ffreestanding -fno-delete-null-pointer-checks -fno-common -fPIE
4075b24479SPaolo BonziniEXTRA_CFLAGS += -fwrapv -fno-strict-aliasing -fno-asynchronous-unwind-tables
4175b24479SPaolo BonziniEXTRA_CFLAGS += -msoft-float
4275b24479SPaolo BonziniEXTRA_CFLAGS += -std=gnu99
43*e3e2708fSThomas HuthLDFLAGS += -Wl,-pie -nostdlib -z noexecstack
44b462fcd5SAlexander Graf
45ebc1d821SPaolo Bonzinicc-test = $(CC) -Werror $1 -c -o /dev/null -xc /dev/null >/dev/null 2>/dev/null
46ebc1d821SPaolo Bonzinicc-option = if $(call cc-test, $1); then \
47ebc1d821SPaolo Bonzini    echo "$(TARGET_PREFIX)$1 detected" && echo "EXTRA_CFLAGS += $1" >&3; else \
48ebc1d821SPaolo Bonzini    echo "$(TARGET_PREFIX)$1 not detected" $(if $2,&& echo "EXTRA_CFLAGS += $2" >&3); fi
49ebc1d821SPaolo Bonzini
50ebc1d821SPaolo Bonziniconfig-cc.mak: Makefile
51ebc1d821SPaolo Bonzini	$(quiet-@)($(call cc-option,-Wno-stringop-overflow); \
52ebc1d821SPaolo Bonzini	    $(call cc-option,-fno-stack-protector); \
53ebc1d821SPaolo Bonzini	    $(call cc-option,-Wno-array-bounds); \
54ebc1d821SPaolo Bonzini	    $(call cc-option,-Wno-gnu); \
55ebc1d821SPaolo Bonzini	    $(call cc-option,-march=z900,-march=z10)) 3> config-cc.mak
56ebc1d821SPaolo Bonzini-include config-cc.mak
57ebc1d821SPaolo Bonzini
583e4415a7SThomas Huthbuild-all: s390-ccw.img s390-netboot.img
59b462fcd5SAlexander Graf
60b462fcd5SAlexander Grafs390-ccw.elf: $(OBJECTS)
61b5fc8458SPaolo Bonzini	$(call quiet-command,$(CC) $(LDFLAGS) -o $@ $(OBJECTS),Linking)
62b462fcd5SAlexander Graf
63b462fcd5SAlexander Grafs390-ccw.img: s390-ccw.elf
64b5fc8458SPaolo Bonzini	$(call quiet-command,$(STRIP) --strip-unneeded $< -o $@,Stripping $< into)
65d884c86dSThomas Huth
66d884c86dSThomas Huth$(OBJECTS): Makefile
67b462fcd5SAlexander Graf
689ffed426SPaolo Bonziniinclude $(SRC_PATH)/netboot.mak
693e4415a7SThomas Huth
701c9f6550SThomas HuthALL_OBJS = $(sort $(OBJECTS) $(NETOBJS) $(LIBCOBJS) $(LIBNETOBJS))
711c9f6550SThomas Huth-include $(ALL_OBJS:%.o=%.d)
721c9f6550SThomas Huth
73b462fcd5SAlexander Grafclean:
7488b3739aSEric Farman	rm -f *.o *.d *.img *.elf *~ *.a
75ebc1d821SPaolo Bonzini
76ebc1d821SPaolo Bonzinidistclean:
77ebc1d821SPaolo Bonzini	rm -f config-cc.mak
78b11f9bd9SPaolo Bonzini
79b11f9bd9SPaolo Bonzini.PHONY: git-submodule-update
80b11f9bd9SPaolo Bonzini$(SRC_PATH)/../../.git-submodule-status: git-submodule-update config-host.mak
81b11f9bd9SPaolo BonziniMakefile: $(SRC_PATH)/../../.git-submodule-status
82b11f9bd9SPaolo Bonzini
83b11f9bd9SPaolo Bonzinigit-submodule-update:
84b11f9bd9SPaolo Bonziniifneq ($(GIT_SUBMODULES_ACTION),ignore)
85b11f9bd9SPaolo Bonzini	$(quiet-@)GIT=git "$(SRC_PATH)/../../scripts/git-submodule.sh" $(GIT_SUBMODULES_ACTION) $(GIT_SUBMODULES)
86b11f9bd9SPaolo Bonziniendif
87