pc-bios/s390-ccw/Makefile: Use -z noexecstack to silence linker warning
[qemu/kevin.git] / pc-bios / s390-ccw / Makefile
blobacfcd1e71a92b2dd25975a040852066403f18544
1 all: build-all
2 # Dummy command so that make thinks it has done something
3 @true
5 include config-host.mak
6 CFLAGS = -O2 -g
7 MAKEFLAGS += -rR
9 GIT_SUBMODULES = roms/SLOF
11 NULL :=
12 SPACE := $(NULL) #
13 TARGET_PREFIX := $(patsubst %/,%:$(SPACE),$(TARGET_DIR))
15 quiet-@ = $(if $(V),,@$(if $1,printf "%s\n" "$(TARGET_PREFIX)$1" && ))
16 quiet-command = $(call quiet-@,$2 $@)$1
18 VPATH_SUFFIXES = %.c %.h %.S %.m %.mak %.sh %.rc Kconfig% %.json.in
19 set-vpath = $(if $1,$(foreach PATTERN,$(VPATH_SUFFIXES),$(eval vpath $(PATTERN) $1)))
20 $(call set-vpath, $(SRC_PATH))
22 # Flags for dependency generation
23 QEMU_DGFLAGS = -MMD -MP -MT $@ -MF $(@D)/$(*F).d
25 %.o: %.c
26 $(call quiet-command,$(CC) $(EXTRA_CFLAGS) $(QEMU_DGFLAGS) $(CFLAGS) \
27 -c -o $@ $<,Compiling)
29 %.o: %.S
30 $(call quiet-command,$(CCAS) $(EXTRA_CFLAGS) $(QEMU_DGFLAGS) $(CFLAGS) \
31 -c -o $@ $<,Assembling)
33 .PHONY : all clean build-all distclean
35 OBJECTS = start.o main.o bootmap.o jump2ipl.o sclp.o menu.o \
36 virtio.o virtio-scsi.o virtio-blkdev.o libc.o cio.o dasd-ipl.o
38 EXTRA_CFLAGS += -Wall
39 EXTRA_CFLAGS += -ffreestanding -fno-delete-null-pointer-checks -fno-common -fPIE
40 EXTRA_CFLAGS += -fwrapv -fno-strict-aliasing -fno-asynchronous-unwind-tables
41 EXTRA_CFLAGS += -msoft-float
42 EXTRA_CFLAGS += -std=gnu99
43 LDFLAGS += -Wl,-pie -nostdlib
45 cc-test = $(CC) -Werror $1 -c -o /dev/null -xc /dev/null >/dev/null 2>/dev/null
46 cc-option = if $(call cc-test, $1); then \
47 echo "$(TARGET_PREFIX)$1 detected" && echo "EXTRA_CFLAGS += $1" >&3; else \
48 echo "$(TARGET_PREFIX)$1 not detected" $(if $2,&& echo "EXTRA_CFLAGS += $2" >&3); fi
50 config-cc.mak: Makefile
51 $(quiet-@)($(call cc-option,-Wno-stringop-overflow); \
52 $(call cc-option,-fno-stack-protector); \
53 $(call cc-option,-Wno-array-bounds); \
54 $(call cc-option,-Wno-gnu); \
55 $(call cc-option,-march=z900,-march=z10)) 3> config-cc.mak
56 -include config-cc.mak
58 LDFLAGS += -Wl,-pie -nostdlib -z noexecstack
60 build-all: s390-ccw.img s390-netboot.img
62 s390-ccw.elf: $(OBJECTS)
63 $(call quiet-command,$(CC) $(LDFLAGS) -o $@ $(OBJECTS),Linking)
65 s390-ccw.img: s390-ccw.elf
66 $(call quiet-command,$(STRIP) --strip-unneeded $< -o $@,Stripping $< into)
68 $(OBJECTS): Makefile
70 include $(SRC_PATH)/netboot.mak
72 ALL_OBJS = $(sort $(OBJECTS) $(NETOBJS) $(LIBCOBJS) $(LIBNETOBJS))
73 -include $(ALL_OBJS:%.o=%.d)
75 clean:
76 rm -f *.o *.d *.img *.elf *~ *.a
78 distclean:
79 rm -f config-cc.mak
81 .PHONY: git-submodule-update
82 $(SRC_PATH)/../../.git-submodule-status: git-submodule-update config-host.mak
83 Makefile: $(SRC_PATH)/../../.git-submodule-status
85 git-submodule-update:
86 ifneq ($(GIT_SUBMODULES_ACTION),ignore)
87 $(quiet-@)GIT=git "$(SRC_PATH)/../../scripts/git-submodule.sh" $(GIT_SUBMODULES_ACTION) $(GIT_SUBMODULES)
88 endif