2 # Dummy command so that make thinks it has done something
5 include ..
/..
/config-host.mak
8 quiet-command
= $(if
$(V
),$1,$(if
$(2),@printf
" %-7s %s\n" $2 $3 && $1, @
$1))
9 cc-option
= $(if
$(shell $(CC
) $1 $2 -S
-o
/dev
/null
-xc
/dev
/null \
10 >/dev
/null
2>&1 && echo OK
),$2,$3)
12 VPATH_SUFFIXES
= %.c
%.h
%.S
%.m
%.mak
%.sh
%.rc Kconfig
% %.json.in
13 set-vpath
= $(if
$1,$(foreach PATTERN
,$(VPATH_SUFFIXES
),$(eval vpath
$(PATTERN
) $1)))
14 $(call set-vpath
, $(SRC_PATH
)/pc-bios
/s390-ccw
)
16 # Flags for dependency generation
17 QEMU_DGFLAGS
= -MMD
-MP
-MT
$@
-MF
$(@D
)/$(*F
).d
20 $(call quiet-command
,$(CC
) $(QEMU_CFLAGS
) $(QEMU_DGFLAGS
) $(CFLAGS
) \
21 -c
-o
$@
$<,"CC","$(TARGET_DIR)$@")
24 $(call quiet-command
,$(CCAS
) $(QEMU_CFLAGS
) $(QEMU_DGFLAGS
) $(CFLAGS
) \
25 -c
-o
$@
$<,"CCAS","$(TARGET_DIR)$@")
27 .PHONY
: all clean build-all
29 OBJECTS
= start.o main.o bootmap.o jump2ipl.o sclp.o menu.o \
30 virtio.o virtio-scsi.o virtio-blkdev.o libc.o cio.o dasd-ipl.o
32 QEMU_CFLAGS
:= -Wall
$(filter -W
%, $(QEMU_CFLAGS
))
33 QEMU_CFLAGS
+= $(call cc-option
,-Werror
$(QEMU_CFLAGS
),-Wno-stringop-overflow
)
34 QEMU_CFLAGS
+= -ffreestanding
-fno-delete-null-pointer-checks
-fno-common
-fPIE
35 QEMU_CFLAGS
+= -fwrapv
-fno-strict-aliasing
-fno-asynchronous-unwind-tables
36 QEMU_CFLAGS
+= $(call cc-option
, $(QEMU_CFLAGS
), -fno-stack-protector
)
37 QEMU_CFLAGS
+= -msoft-float
38 QEMU_CFLAGS
+= $(call cc-option
, $(QEMU_CFLAGS
),-march
=z900
,-march
=z10
)
39 QEMU_CFLAGS
+= -std
=gnu99
40 LDFLAGS
+= -Wl
,-pie
-nostdlib
42 build-all
: s390-ccw.img s390-netboot.img
44 s390-ccw.elf
: $(OBJECTS
)
45 $(call quiet-command
,$(CC
) $(LDFLAGS
) -o
$@
$(OBJECTS
),"BUILD","$(TARGET_DIR)$@")
49 s390-ccw.img
: s390-ccw.elf
50 $(call quiet-command
,$(STRIP
) --strip-unneeded
$< -o
$@
,"STRIP","$(TARGET_DIR)$@")
54 ifneq ($(wildcard $(SRC_PATH
)/roms
/SLOF
/lib
/libnet
),)
55 include $(SRC_PATH
)/pc-bios
/s390-ccw
/netboot.mak
58 @echo
"s390-netboot.img not built since roms/SLOF/ is not available."
61 ALL_OBJS
= $(sort $(OBJECTS
) $(NETOBJS
) $(LIBCOBJS
) $(LIBNETOBJS
))
62 -include $(ALL_OBJS
:%.o
=%.d
)
65 rm -f
*.o
*.d
*.img
*.elf
*~
*.a