qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Isaku Yamahata <yamahata@valinux.co.jp>
To: Gerd Hoffmann <kraxel@redhat.com>
Cc: vgabios-developers@nongnu.org, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 1/5] Makefile cleanup
Date: Fri, 7 May 2010 23:38:16 +0900	[thread overview]
Message-ID: <20100507143816.GB20294@valinux.co.jp> (raw)
In-Reply-To: <1273226987-10066-1-git-send-email-kraxel@redhat.com>

Hi. If gmake extension is allowed, nasty rm in the rule can be removed
by using intermediate file which is removed after build.
We can combine your cleanup with mine.

[PATCH] vgabios: Makefile: clean up using gmake extension.

clean up nasty rule by using gmake extension

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
---
 Makefile |   92 +++++++++++++++++++++++++++++--------------------------------
 1 files changed, 44 insertions(+), 48 deletions(-)

diff --git a/Makefile b/Makefile
index 00e8c66..4ead342 100644
--- a/Makefile
+++ b/Makefile
@@ -17,13 +17,14 @@ VGABIOS_DATE = "-DVGABIOS_DATE=\"$(RELDATE)\""
 all: bios cirrus-bios
 
 
-bios: biossums vgabios.bin vgabios.debug.bin
+bios: biossums VGABIOS-lgpl-latest.bin VGABIOS-lgpl-latest.debug.bin
 
-cirrus-bios: vgabios-cirrus.bin vgabios-cirrus.debug.bin
+cirrus-bios: VGABIOS-lgpl-latest.cirrus.bin VGABIOS-lgpl-latest.cirrus.debug.bin
 
 clean:
 	/bin/rm -f  biossums vbetables-gen vbetables.h *.o *.s *.ld86 \
-          temp.awk.* vgabios*.orig _vgabios_* _vgabios-debug_* core vgabios*.bin vgabios*.txt $(RELEASE).bin *.bak
+          temp.awk.* vgabios*.orig _vgabios_* _vgabios.*_* core \
+          VGABIOS-lgpl-latest*.bin vgabios*.bin vgabios*.txt $(RELEASE).bin *.bak
 
 dist-clean: clean
 
@@ -37,51 +38,46 @@ release:
 	cp VGABIOS-lgpl-latest.cirrus.debug.bin ../$(RELEASE).cirrus.debug.bin
 	tar czvf ../$(RELEASE).tgz --exclude CVS -C .. $(RELEASE)/
 
-vgabios.bin: vgabios.c vgabios.h vgafonts.h vgatables.h vbe.h vbe.c vbetables.h
-	$(GCC) -E -P vgabios.c $(VGABIOS_VERS) -DVBE $(VGABIOS_DATE) > _vgabios_.c
-	$(BCC) -o vgabios.s -C-c -D__i86__ -S -0 _vgabios_.c
-	sed -e 's/^\.text//' -e 's/^\.data//' vgabios.s > _vgabios_.s
-	$(AS86) _vgabios_.s -b vgabios.bin -u -w- -g -0 -j -O -l vgabios.txt
-	rm -f _vgabios_.s _vgabios_.c vgabios.s
-	mv vgabios.bin VGABIOS-lgpl-latest.bin
-	./biossums VGABIOS-lgpl-latest.bin
-	ls -l VGABIOS-lgpl-latest.bin
-
-vgabios.debug.bin: vgabios.c vgabios.h vgafonts.h vgatables.h vbe.h vbe.c vbetables.h
-	$(GCC) -E -P vgabios.c $(VGABIOS_VERS) -DVBE -DDEBUG $(VGABIOS_DATE) > _vgabios-debug_.c
-	$(BCC) -o vgabios-debug.s -C-c -D__i86__ -S -0 _vgabios-debug_.c
-	sed -e 's/^\.text//' -e 's/^\.data//' vgabios-debug.s > _vgabios-debug_.s
-	$(AS86) _vgabios-debug_.s -b vgabios.debug.bin -u -w- -g -0 -j -O -l vgabios.debug.txt
-	rm -f _vgabios-debug_.s _vgabios-debug_.c vgabios-debug.s
-	mv vgabios.debug.bin VGABIOS-lgpl-latest.debug.bin
-	./biossums VGABIOS-lgpl-latest.debug.bin
-	ls -l VGABIOS-lgpl-latest.debug.bin
-
-vgabios-cirrus.bin: vgabios.c vgabios.h vgafonts.h vgatables.h clext.c
-	$(GCC) -E -P vgabios.c $(VGABIOS_VERS) -DCIRRUS -DPCIBIOS $(VGABIOS_DATE) > _vgabios-cirrus_.c
-	$(BCC) -o vgabios-cirrus.s -C-c -D__i86__ -S -0 _vgabios-cirrus_.c
-	sed -e 's/^\.text//' -e 's/^\.data//' vgabios-cirrus.s > _vgabios-cirrus_.s
-	$(AS86) _vgabios-cirrus_.s -b vgabios-cirrus.bin -u -w- -g -0 -j -O -l vgabios.cirrus.txt
-	rm -f _vgabios-cirrus_.s _vgabios-cirrus_.c vgabios-cirrus.s
-	mv vgabios-cirrus.bin VGABIOS-lgpl-latest.cirrus.bin
-	./biossums VGABIOS-lgpl-latest.cirrus.bin
-	ls -l VGABIOS-lgpl-latest.cirrus.bin
-
-vgabios-cirrus.debug.bin: vgabios.c vgabios.h vgafonts.h vgatables.h clext.c
-	$(GCC) -E -P vgabios.c $(VGABIOS_VERS) -DCIRRUS -DCIRRUS_DEBUG -DPCIBIOS $(VGABIOS_DATE) > _vgabios-cirrus-debug_.c
-	$(BCC) -o vgabios-cirrus-debug.s -C-c -D__i86__ -S -0 _vgabios-cirrus-debug_.c
-	sed -e 's/^\.text//' -e 's/^\.data//' vgabios-cirrus-debug.s > _vgabios-cirrus-debug_.s
-	$(AS86) _vgabios-cirrus-debug_.s -b vgabios.cirrus.debug.bin -u -w- -g -0 -j -O -l vgabios.cirrus.debug.txt
-	rm -f _vgabios-cirrus-debug_.s _vgabios-cirrus-debug_.c vgabios-cirrus-debug.s
-	mv vgabios.cirrus.debug.bin VGABIOS-lgpl-latest.cirrus.debug.bin
-	./biossums VGABIOS-lgpl-latest.cirrus.debug.bin
-	ls -l VGABIOS-lgpl-latest.cirrus.debug.bin
-
-biossums: biossums.c
-	$(CC) -o biossums biossums.c
-
-vbetables-gen: vbetables-gen.c
-	$(CC) -o vbetables-gen vbetables-gen.c
+define gcc-e-p
+	$(GCC) -E -P $< $(VGABIOS_VERS) $(EXTRA_DEFINES) $(VGABIOS_DATE) > $@
+endef
+
+_vgabios_.c: EXTRA_DEFINES = -DVBE
+_vgabios_.c: vgabios.c vgabios.h vgafonts.h vgatables.h vbe.h vbe.c vbetables.h
+	$(gcc-e-p)
+
+_vgabios.debug_.c: EXTRA_DEFINES = -DVBE -DDEBUG
+_vgabios.debug_.c: vgabios.c vgabios.h vgafonts.h vgatables.h vbe.h vbe.c vbetables.h
+	$(gcc-e-p)
+
+_vgabios.cirrus_.c: EXTRA_DEFINES = -DCIRRUS -DPCIBIOS
+_vgabios.cirrus_.c: vgabios.c vgabios.h vgafonts.h vgatables.h clext.c
+	$(gcc-e-p)
+
+_vgabios.cirrus.debug_.c: EXTRA_DEFINES = -DCIRRUS -DCIRRUS_DEBUG -DPCIBIOS
+_vgabios.cirrus.debug_.c: vgabios.c vgabios.h vgafonts.h vgatables.h clext.c
+	$(gcc-e-p)
+
+.INTERMEDIATE: _vgabios_.c _vgabios.debug_.c _vgabios.cirrus_.c _vgabios.cirrus.debug_.c
+
+
+%.s: _%_.c
+	$(BCC) -o $@ -C-c -D__i86__ -S -0 $<
+
+_%_.s: %.s
+	sed -e 's/^\.text//' -e 's/^\.data//' $< > $@
+
+%.bin %.txt: _%_.s
+	$(AS86) $< -b $*.bin -u -w- -g -0 -j -O -l $*.txt
+
+VGABIOS-lgpl-latest%bin: vgabios%bin
+	mv $< $@
+	./biossums $@
+	ls -l $@
+
+# for biossums and vbetables-gen
+%: %.c
+	$(CC) -o $@ $<
 
 vbetables.h: vbetables-gen
 	./vbetables-gen > $@
-- 
1.6.6.1



On Fri, May 07, 2010 at 12:09:43PM +0200, Gerd Hoffmann wrote:
> Use a single rule for building bios binaries.
> Use target specific variables to set compile flags.
> 
> This makes it more obvious what the differences between the versions
> are.  It also makes it easier to add new bios binaries with slightly
> different settings.
> 
> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
> ---
>  Makefile |   76 +++++++++++++++++++++++++++----------------------------------
>  1 files changed, 34 insertions(+), 42 deletions(-)
> 
> diff --git a/Makefile b/Makefile
> index 00e8c66..c3c744c 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -16,8 +16,7 @@ VGABIOS_DATE = "-DVGABIOS_DATE=\"$(RELDATE)\""
>  
>  all: bios cirrus-bios
>  
> -
> -bios: biossums vgabios.bin vgabios.debug.bin
> +bios: vgabios.bin vgabios.debug.bin
>  
>  cirrus-bios: vgabios-cirrus.bin vgabios-cirrus.debug.bin
>  
> @@ -27,6 +26,39 @@ clean:
>  
>  dist-clean: clean
>  
> +# source files
> +VGA_FILES := vgabios.c vgabios.h vgafonts.h vgatables.h
> +VBE_FILES := vbe.h vbe.c vbetables.h
> +
> +# build flags
> +vgabios.bin              : VGAFLAGS := -DVBE
> +vgabios.debug.bin        : VGAFLAGS := -DVBE -DDEBUG
> +vgabios-cirrus.bin       : VGAFLAGS := -DCIRRUS -DPCIBIOS 
> +vgabios-cirrus.debug.bin : VGAFLAGS := -DCIRRUS -DPCIBIOS -DCIRRUS_DEBUG
> +
> +# dist names
> +vgabios.bin              : DISTNAME := VGABIOS-lgpl-latest.bin
> +vgabios.debug.bin        : DISTNAME := VGABIOS-lgpl-latest.debug.bin
> +vgabios-cirrus.bin       : DISTNAME := VGABIOS-lgpl-latest.cirrus.bin
> +vgabios-cirrus.debug.bin : DISTNAME := VGABIOS-lgpl-latest.cirrus.debug.bin
> +
> +# dependencies
> +vgabios.bin              : $(VGA_FILES) $(VBE_FILES) biossums
> +vgabios.debug.bin        : $(VGA_FILES) $(VBE_FILES) biossums
> +vgabios-cirrus.bin       : $(VGA_FILES) clext.c biossums
> +vgabios-cirrus.debug.bin : $(VGA_FILES) clext.c biossums
> +
> +# build rule
> +%.bin:
> +	$(GCC) -E -P vgabios.c $(VGABIOS_VERS) $(VGAFLAGS) $(VGABIOS_DATE) > _$*_.c
> +	$(BCC) -o $*.s -C-c -D__i86__ -S -0 _$*_.c
> +	sed -e 's/^\.text//' -e 's/^\.data//' $*.s > _$*_.s
> +	$(AS86) _$*_.s -b $*.bin -u -w- -g -0 -j -O -l $*.txt
> +	rm -f _$*_.s _$*_.c $*.s
> +	mv $*.bin $(DISTNAME)
> +	./biossums $(DISTNAME)
> +	ls -l $(DISTNAME)
> +
>  release: 
>  	VGABIOS_VERS=\"-DVGABIOS_VERS=\\\"$(RELVERS)\\\"\" make bios cirrus-bios
>  	/bin/rm -f  *.o *.s *.ld86 \
> @@ -37,46 +69,6 @@ release:
>  	cp VGABIOS-lgpl-latest.cirrus.debug.bin ../$(RELEASE).cirrus.debug.bin
>  	tar czvf ../$(RELEASE).tgz --exclude CVS -C .. $(RELEASE)/
>  
> -vgabios.bin: vgabios.c vgabios.h vgafonts.h vgatables.h vbe.h vbe.c vbetables.h
> -	$(GCC) -E -P vgabios.c $(VGABIOS_VERS) -DVBE $(VGABIOS_DATE) > _vgabios_.c
> -	$(BCC) -o vgabios.s -C-c -D__i86__ -S -0 _vgabios_.c
> -	sed -e 's/^\.text//' -e 's/^\.data//' vgabios.s > _vgabios_.s
> -	$(AS86) _vgabios_.s -b vgabios.bin -u -w- -g -0 -j -O -l vgabios.txt
> -	rm -f _vgabios_.s _vgabios_.c vgabios.s
> -	mv vgabios.bin VGABIOS-lgpl-latest.bin
> -	./biossums VGABIOS-lgpl-latest.bin
> -	ls -l VGABIOS-lgpl-latest.bin
> -
> -vgabios.debug.bin: vgabios.c vgabios.h vgafonts.h vgatables.h vbe.h vbe.c vbetables.h
> -	$(GCC) -E -P vgabios.c $(VGABIOS_VERS) -DVBE -DDEBUG $(VGABIOS_DATE) > _vgabios-debug_.c
> -	$(BCC) -o vgabios-debug.s -C-c -D__i86__ -S -0 _vgabios-debug_.c
> -	sed -e 's/^\.text//' -e 's/^\.data//' vgabios-debug.s > _vgabios-debug_.s
> -	$(AS86) _vgabios-debug_.s -b vgabios.debug.bin -u -w- -g -0 -j -O -l vgabios.debug.txt
> -	rm -f _vgabios-debug_.s _vgabios-debug_.c vgabios-debug.s
> -	mv vgabios.debug.bin VGABIOS-lgpl-latest.debug.bin
> -	./biossums VGABIOS-lgpl-latest.debug.bin
> -	ls -l VGABIOS-lgpl-latest.debug.bin
> -
> -vgabios-cirrus.bin: vgabios.c vgabios.h vgafonts.h vgatables.h clext.c
> -	$(GCC) -E -P vgabios.c $(VGABIOS_VERS) -DCIRRUS -DPCIBIOS $(VGABIOS_DATE) > _vgabios-cirrus_.c
> -	$(BCC) -o vgabios-cirrus.s -C-c -D__i86__ -S -0 _vgabios-cirrus_.c
> -	sed -e 's/^\.text//' -e 's/^\.data//' vgabios-cirrus.s > _vgabios-cirrus_.s
> -	$(AS86) _vgabios-cirrus_.s -b vgabios-cirrus.bin -u -w- -g -0 -j -O -l vgabios.cirrus.txt
> -	rm -f _vgabios-cirrus_.s _vgabios-cirrus_.c vgabios-cirrus.s
> -	mv vgabios-cirrus.bin VGABIOS-lgpl-latest.cirrus.bin
> -	./biossums VGABIOS-lgpl-latest.cirrus.bin
> -	ls -l VGABIOS-lgpl-latest.cirrus.bin
> -
> -vgabios-cirrus.debug.bin: vgabios.c vgabios.h vgafonts.h vgatables.h clext.c
> -	$(GCC) -E -P vgabios.c $(VGABIOS_VERS) -DCIRRUS -DCIRRUS_DEBUG -DPCIBIOS $(VGABIOS_DATE) > _vgabios-cirrus-debug_.c
> -	$(BCC) -o vgabios-cirrus-debug.s -C-c -D__i86__ -S -0 _vgabios-cirrus-debug_.c
> -	sed -e 's/^\.text//' -e 's/^\.data//' vgabios-cirrus-debug.s > _vgabios-cirrus-debug_.s
> -	$(AS86) _vgabios-cirrus-debug_.s -b vgabios.cirrus.debug.bin -u -w- -g -0 -j -O -l vgabios.cirrus.debug.txt
> -	rm -f _vgabios-cirrus-debug_.s _vgabios-cirrus-debug_.c vgabios-cirrus-debug.s
> -	mv vgabios.cirrus.debug.bin VGABIOS-lgpl-latest.cirrus.debug.bin
> -	./biossums VGABIOS-lgpl-latest.cirrus.debug.bin
> -	ls -l VGABIOS-lgpl-latest.cirrus.debug.bin
> -
>  biossums: biossums.c
>  	$(CC) -o biossums biossums.c
>  
> -- 
> 1.6.6.1
> 
> 
> 

-- 
yamahata

  parent reply	other threads:[~2010-05-07 14:41 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-07 10:09 [Qemu-devel] [PATCH 1/5] Makefile cleanup Gerd Hoffmann
2010-05-07 10:09 ` [Qemu-devel] [PATCH 2/5] Add defines for PCI IDs Gerd Hoffmann
2010-05-07 15:32   ` Blue Swirl
2010-05-10  7:51     ` Gerd Hoffmann
2010-05-07 10:09 ` [Qemu-devel] [PATCH 3/5] Add qemu stdvga pci bios Gerd Hoffmann
2010-05-07 10:09 ` [Qemu-devel] [PATCH 4/5] update pci_get_lfb_addr for vmware vga Gerd Hoffmann
2010-05-07 10:09 ` [Qemu-devel] [PATCH 5/5] Add qemu vmware vga pci bios Gerd Hoffmann
2010-05-07 14:38 ` Isaku Yamahata [this message]
2010-05-20 12:57 ` [Qemu-devel] vgabios plans ( Re: [PATCH 1/5] Makefile cleanup) Gerd Hoffmann
2010-05-20 13:04   ` [Qemu-devel] " Anthony Liguori
2010-05-21 13:29     ` Gerd Hoffmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100507143816.GB20294@valinux.co.jp \
    --to=yamahata@valinux.co.jp \
    --cc=kraxel@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=vgabios-developers@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).