Remove dependency on config.mak and simplify Makefile.

Signed-off-by: Pierrick Bouvier <[email protected]>
---
 roms/Makefile          |  6 ++++
 roms/s390-ccw/Makefile | 67 ++++++++++++++++--------------------------
 2 files changed, 32 insertions(+), 41 deletions(-)

diff --git a/roms/Makefile b/roms/Makefile
index 57a53944b9b..73d0277defd 100644
--- a/roms/Makefile
+++ b/roms/Makefile
@@ -76,6 +76,7 @@ default help:
        @echo "  qboot              -- update qboot"
        @echo "  hppa-firmware      -- update 32- and 64-bit hppa firmware"
        @echo "  optionrom-bin      -- update optionrom binaries"
+       @echo "  s390-ccw-rom       -- update s390-ccw.img"
        @echo "  clean              -- delete the files generated by the 
previous" \
                                      "build targets"
 
@@ -225,6 +226,10 @@ optionrom-bin:
         optionrom/pvh.bin \
        ../pc-bios/
 
+s390-ccw-rom:
+       $(MAKE) -C s390-ccw
+       cp s390-ccw/s390-ccw.img ../pc-bios/
+
 clean:
        rm -rf seabios/.config seabios/out seabios/builds
        $(MAKE) -C ipxe/src veryclean
@@ -236,6 +241,7 @@ clean:
        $(MAKE) -C u-boot-sam460ex distclean
        $(MAKE) -C skiboot clean
        $(MAKE) -C optionrom distclean
+       $(MAKE) -C s390-ccw distclean
        rm -rf Build
        $(MAKE) -C opensbi clean
        $(MAKE) -C qboot clean
diff --git a/roms/s390-ccw/Makefile b/roms/s390-ccw/Makefile
index 2109d167813..74078ce07eb 100644
--- a/roms/s390-ccw/Makefile
+++ b/roms/s390-ccw/Makefile
@@ -1,43 +1,32 @@
-all: build-all
-# Dummy command so that make thinks it has done something
-       @true
+all: s390-ccw.img
 
-include config-host.mak
-CFLAGS = -O2 -g -I $(SRC_PATH)/../../include/hw/s390x/ipl
+CROSS := $(or $(CROSS),s390x-linux-gnu-)
+AR := $(CROSS)ar
+CC := $(CROSS)gcc
+STRIP := $(CROSS)strip
+
+CFLAGS = -O2 -g -I ../../include/hw/s390x/ipl
 LDFLAGS ?=
 MAKEFLAGS += -rR
 
 GIT_SUBMODULES = roms/SLOF
 
-NULL :=
-SPACE := $(NULL) #
-TARGET_PREFIX := $(patsubst %/,%:$(SPACE),$(TARGET_DIR))
-
-quiet-@ = $(if $(V),,@$(if $1,printf "%s\n" "$(TARGET_PREFIX)$1" && ))
-quiet-command = $(call quiet-@,$2 $@)$1
-
-VPATH_SUFFIXES = %.c %.h %.S %.m %.mak %.sh %.rc Kconfig% %.json.in
-set-vpath = $(if $1,$(foreach PATTERN,$(VPATH_SUFFIXES),$(eval vpath 
$(PATTERN) $1)))
-$(call set-vpath, $(SRC_PATH))
-
 # Flags for dependency generation
 QEMU_DGFLAGS = -MMD -MP -MT $@ -MF $(@D)/$(*F).d
 
 %.o: %.c
-       $(call quiet-command,$(CC) $(EXTRA_CFLAGS) $(QEMU_DGFLAGS) $(CFLAGS) \
-              -c -o $@ $<,Compiling)
+       $(CC) $(EXTRA_CFLAGS) $(QEMU_DGFLAGS) $(CFLAGS) -c -o $@ $<
 
 %.o: %.S
-       $(call quiet-command,$(CCAS) $(EXTRA_CFLAGS) $(QEMU_DGFLAGS) $(CFLAGS) \
-              -c -o $@ $<,Assembling)
+       $(CC) $(EXTRA_CFLAGS) $(QEMU_DGFLAGS) $(CFLAGS) -c -o $@ $<
 
-.PHONY : all clean build-all distclean
+.PHONY : all clean distclean
 
 OBJECTS = start.o main.o bootmap.o jump2ipl.o sclp.o menu.o netmain.o \
          virtio.o virtio-net.o virtio-scsi.o virtio-blkdev.o cio.o dasd-ipl.o \
          virtio-ccw.o clp.o pci.o virtio-pci.o secure-ipl.o
 
-SLOF_DIR := $(SRC_PATH)/../../roms/SLOF
+SLOF_DIR := ../../roms/SLOF
 
 LIBC_INC := -nostdinc -I$(SLOF_DIR)/lib/libc/include
 LIBNET_INC := -I$(SLOF_DIR)/lib/libnet
@@ -52,8 +41,8 @@ EXTRA_LDFLAGS += -static-pie -nostdlib -z noexecstack -z text
 
 cc-test = $(CC) -Werror $1 -c -o /dev/null -xc /dev/null >/dev/null 2>/dev/null
 cc-option = if $(call cc-test, $1); then \
-    echo "$(TARGET_PREFIX)$1 detected" && echo "EXTRA_CFLAGS += $1" >&3; else \
-    echo "$(TARGET_PREFIX)$1 not detected" $(if $2,&& echo "EXTRA_CFLAGS += 
$2" >&3); fi
+    echo "$1 detected" && echo "EXTRA_CFLAGS += $1" >&3; else \
+    echo "$1 not detected" $(if $2,&& echo "EXTRA_CFLAGS += $2" >&3); fi
 
 config-cc.mak: Makefile
        $(quiet-@)($(call cc-option,-Wno-stringop-overflow); \
@@ -70,30 +59,30 @@ LIBC_CFLAGS = $(EXTRA_CFLAGS) $(CFLAGS) $(LIBC_INC) 
$(LIBNET_INC) \
 
 CTYPE_OBJS = isdigit.o isxdigit.o toupper.o
 %.o : $(SLOF_DIR)/lib/libc/ctype/%.c
-       $(call quiet-command,$(CC) $(LIBC_CFLAGS) -c -o $@ $<,Compiling)
+       $(CC) $(LIBC_CFLAGS) -c -o $@ $<
 
 STRING_OBJS = strcat.o strchr.o strrchr.o strcpy.o strlen.o strncpy.o \
              strcmp.o strncmp.o strcasecmp.o strncasecmp.o strstr.o \
              memset.o memcpy.o memmove.o memcmp.o
 %.o : $(SLOF_DIR)/lib/libc/string/%.c
-       $(call quiet-command,$(CC) $(LIBC_CFLAGS) -c -o $@ $<,Compiling)
+       $(CC) $(LIBC_CFLAGS) -c -o $@ $<
 
 STDLIB_OBJS = atoi.o atol.o strtoul.o strtol.o rand.o malloc.o free.o
 %.o : $(SLOF_DIR)/lib/libc/stdlib/%.c
-       $(call quiet-command,$(CC) $(LIBC_CFLAGS) -c -o $@ $<,Compiling)
+       $(CC) $(LIBC_CFLAGS) -c -o $@ $<
 
 STDIO_OBJS = sprintf.o snprintf.o vfprintf.o vsnprintf.o vsprintf.o fprintf.o \
             printf.o putc.o puts.o putchar.o stdchnls.o fileno.o
 %.o : $(SLOF_DIR)/lib/libc/stdio/%.c
-       $(call quiet-command,$(CC) $(LIBC_CFLAGS) -c -o $@ $<,Compiling)
+       $(CC) $(LIBC_CFLAGS) -c -o $@ $<
 
 sbrk.o: $(SLOF_DIR)/slof/sbrk.c
-       $(call quiet-command,$(CC) $(LIBC_CFLAGS) -c -o $@ $<,Compiling)
+       $(CC) $(LIBC_CFLAGS) -c -o $@ $<
 
 LIBCOBJS := $(STRING_OBJS) $(CTYPE_OBJS) $(STDLIB_OBJS) $(STDIO_OBJS) sbrk.o
 
 libc.a: $(LIBCOBJS)
-       $(call quiet-command,$(AR) -rc $@ $^,Creating static library)
+       $(AR) -rc $@ $^
 
 # libnet files:
 
@@ -103,20 +92,16 @@ LIBNETCFLAGS = $(EXTRA_CFLAGS) $(CFLAGS) $(LIBC_INC) 
$(LIBNET_INC) \
               -DDHCPARCH=0x1F -MMD -MP -MT $@ -MF $(@:%.o=%.d)
 
 %.o : $(SLOF_DIR)/lib/libnet/%.c
-       $(call quiet-command,$(CC) $(LIBNETCFLAGS) -c -o $@ $<,Compiling)
+       $(CC) $(LIBNETCFLAGS) -c -o $@ $<
 
 libnet.a: $(LIBNETOBJS)
-       $(call quiet-command,$(AR) -rc $@ $^,Creating static library)
-
-# Main targets:
-
-build-all: s390-ccw.img
+       $(AR) -rc $@ $^
 
 s390-ccw.elf: $(OBJECTS) libnet.a libc.a
-       $(call quiet-command,$(CC) $(EXTRA_LDFLAGS) $(LDFLAGS) -o $@ $^,Linking)
+       $(CC) $(EXTRA_LDFLAGS) $(LDFLAGS) -o $@ $^
 
 s390-ccw.img: s390-ccw.elf
-       $(call quiet-command,$(STRIP) --strip-unneeded $< -o $@,Stripping $< 
into)
+       $(STRIP) --strip-unneeded $< -o $@
 
 $(OBJECTS): Makefile
 
@@ -126,14 +111,14 @@ ALL_OBJS = $(sort $(OBJECTS) $(LIBCOBJS) $(LIBNETOBJS))
 clean:
        rm -f *.o *.d *.img *.elf *~ *.a
 
-distclean:
+distclean: clean
        rm -f config-cc.mak
 
 .PHONY: git-submodule-update
-$(SRC_PATH)/../../.git-submodule-status: git-submodule-update config-host.mak
+$(SRC_PATH)/../../.git-submodule-status: git-submodule-update
 Makefile: $(SRC_PATH)/../../.git-submodule-status
 
 git-submodule-update:
 ifneq ($(GIT_SUBMODULES_ACTION),ignore)
-       $(quiet-@)GIT=git "$(SRC_PATH)/../../scripts/git-submodule.sh" 
$(GIT_SUBMODULES_ACTION) $(GIT_SUBMODULES)
+       $(quiet-@)GIT=git "../../scripts/git-submodule.sh" 
$(GIT_SUBMODULES_ACTION) $(GIT_SUBMODULES)
 endif
-- 
2.43.0


Reply via email to