Skip to contentSkip to conversation

Replace genmk.rb with GNU make construction

RFC New Vladimir 'phcoder' Serbinenko 1 participant 1 message Jul 22, 2009 Kbuild

lore
Share & tools
lore
#0 lore raw

RFC 1/1 Replace genmk.rb with GNU make construction

Hello. genmk.rb is a point where our build system has the most problems. For once ruby is a problematic dependency on some platforms. Then few people here understand ruby enough. And thirdly genmk.rb prevents splitting *_SOURCES across .rmk. So I propose to switch to GNU make which is already our dependency in any case. Here I put a working prototype of such solution. I intentionally omitted deletion of genmk.rb and .rmk->.mk renaming from this patch so it's easier to read
This patch is just a prototype. It has 3 problems I currently aware of:
1) External build is untested
2) non i386-pc build is untested
3) make clean fails because of command line is too long

Signature · 4 lines
Regards
Vladimir 'phcoder' Serbinenko

Personal git repository: http://repo.or.cz/w/grub2/phcoder.git
Makefile.in +3 -6
index 25acce7..9d7ce62 100644
@@ -97,6 +97,7 @@ LIBCURSES = @LIBCURSES@
 LIBUSB = @LIBUSB@
 YACC = @YACC@
 UNIFONT_BDF = @UNIFONT_BDF@
+TRUE=true
 
 # Options.
 enable_grub_emu = @enable_grub_emu@
@@ -134,12 +135,8 @@ MAINTAINER_CLEANFILES = $(srcdir)/configure $(addprefix $(srcdir)/,$(MKFILES))
 all: all-local
 
 ### Include an arch-specific Makefile.
-$(addprefix $(srcdir)/,$(MKFILES)): %.mk: %.rmk genmk.rb
-	if test "x$(RUBY)" = x; then \
-	  touch $@; \
-	else \
-	  $(RUBY) $(srcdir)/genmk.rb < $< > $@; \
-	fi
+$(addprefix $(srcdir)/,$(MKFILES)): %.mk: %.rmk
+	  cat $< > $@; \
 
 include $(srcdir)/conf/$(target_cpu)-$(platform).mk
 
autogen.sh +1 -1
index 6895de2..15e291b 100755
@@ -6,7 +6,7 @@ autoconf
 autoheader
 echo timestamp > stamp-h.in
 for rmk in conf/*.rmk; do
-  ruby genmk.rb < $rmk > `echo $rmk | sed 's/\.rmk$/.mk/'`
+  cat $rmk > `echo $rmk | sed 's/\.rmk$/.mk/'`
 done
 ./gendistlist.sh > DISTLIST
 
conf/common.rmk +207 -15

258 lines not on this page · raw message

conf/i386-coreboot.rmk +5 -2
index 7ba5737..c57680c 100644
@@ -5,7 +5,8 @@ COMMON_CFLAGS = -fno-builtin -mrtd -mregparm=3 -m32
 COMMON_LDFLAGS	= -m32 -nostdlib
 
 # Used by various components.  These rules need to precede them.
-script/sh/lexer.c_DEPENDENCIES = grub_script.tab.h
+script/sh/lexer.c.dep: grub_script.tab.h
+	$(TRUE)
 
 # Images.
 
@@ -104,7 +105,9 @@ grub_mkdevicemap_SOURCES = util/grub-mkdevicemap.c util/deviceiter.c \
 	util/devicemap.c util/misc.c
 
 # For grub-emu.
-util/grub-emu.c_DEPENDENCIES = grub_emu_init.h
+util/grub-emu.c.dep: grub_emu_init.h
+	$(TRUE)
+
 grub_emu_SOURCES = commands/minicmd.c commands/cat.c commands/cmp.c	\
 	commands/configfile.c commands/echo.c commands/help.c		\
 	commands/handler.c commands/ls.c commands/test.c 		\
conf/i386-efi.rmk +6 -3
index 9177b9d..1e38488 100644
@@ -5,7 +5,8 @@ COMMON_CFLAGS = -fno-builtin -m32
 COMMON_LDFLAGS = -melf_i386 -nostdlib
 
 # Used by various components.  These rules need to precede them.
-script/sh/lexer.c_DEPENDENCIES = grub_script.tab.h
+script/sh/lexer.c.dep: grub_script.tab.h
+	$(TRUE)
 
 # Utilities.
 bin_UTILITIES = grub-mkimage
@@ -17,7 +18,8 @@ sbin_UTILITIES = grub-mkdevicemap
 # For grub-mkimage.
 grub_mkimage_SOURCES = util/i386/efi/grub-mkimage.c util/misc.c \
 	util/resolve.c
-util/i386/efi/grub-mkimage.c_DEPENDENCIES = Makefile
+util/i386/efi/grub-mkimage.c.dep: Makefile
+	$(TRUE)
 
 # For grub-setup.
 #grub_setup_SOURCES = util/i386/pc/grub-setup.c util/hostdisk.c	\
@@ -32,7 +34,8 @@ grub_mkdevicemap_SOURCES = util/grub-mkdevicemap.c util/deviceiter.c \
 	util/devicemap.c util/misc.c
 
 # For grub-emu.
-util/grub-emu.c_DEPENDENCIES = grub_emu_init.h
+util/grub-emu.c.dep: grub_emu_init.h
+	$(TRUE)
 grub_emu_SOURCES = commands/minicmd.c commands/cat.c commands/cmp.c 	\
 	commands/configfile.c commands/help.c				\
 	commands/handler.c commands/ls.c commands/test.c 		\
conf/i386-ieee1275.rmk +4 -2
index 0321979..98e4de7 100644
@@ -5,7 +5,8 @@ COMMON_CFLAGS	= -ffreestanding -mrtd -mregparm=3
 COMMON_LDFLAGS	= -nostdlib
 
 # Used by various components.  These rules need to precede them.
-script/sh/lexer.c_DEPENDENCIES = grub_script.tab.h
+script/sh/lexer.c.dep: grub_script.tab.h
+	$(TRUE)
 
 # Images.
 pkglib_PROGRAMS = kernel.img
@@ -58,7 +59,8 @@ grub_mkdevicemap_SOURCES = util/grub-mkdevicemap.c util/deviceiter.c \
 	util/devicemap.c util/misc.c
 
 # For grub-emu.
-util/grub-emu.c_DEPENDENCIES = grub_emu_init.h
+util/grub-emu.c.dep: grub_emu_init.h
+	$(TRUE)
 grub_emu_SOURCES = commands/minicmd.c commands/cat.c commands/cmp.c	\
 	commands/configfile.c commands/echo.c commands/help.c		\
 	commands/handler.c commands/ls.c commands/test.c 		\
conf/i386-pc.rmk +9 -4
index 798aee2..d5ad6a1 100644
@@ -7,7 +7,8 @@ COMMON_CFLAGS = -fno-builtin -mrtd -mregparm=3 -m32
 COMMON_LDFLAGS = -m32 -nostdlib
 
 # Used by various components.  These rules need to precede them.
-script/sh/lexer.c_DEPENDENCIES = grub_script.tab.h
+script/sh/lexer.c.dep: grub_script.tab.h
+	$(TRUE)
 
 # Images.
 pkglib_IMAGES = boot.img diskboot.img kernel.img pxeboot.img cdboot.img
@@ -92,10 +93,13 @@ endif
 grub_mkimage_SOURCES = util/i386/pc/grub-mkimage.c util/misc.c \
 	util/resolve.c lib/LzmaEnc.c lib/LzFind.c
 grub_mkimage_CFLAGS = -DGRUB_KERNEL_MACHINE_LINK_ADDR=$(GRUB_KERNEL_MACHINE_LINK_ADDR)
-util/i386/pc/grub-mkimage.c_DEPENDENCIES = Makefile
+util/i386/pc/grub-mkimage.c.dep: Makefile
+	$(TRUE)
 
 # For grub-setup.
-util/i386/pc/grub-setup.c_DEPENDENCIES = grub_setup_init.h
+util/i386/pc/grub-setup.c.dep: grub_setup_init.h
+	$(TRUE)
+
 grub_setup_SOURCES = util/i386/pc/grub-setup.c util/hostdisk.c	\
 	util/misc.c util/getroot.c kern/device.c kern/disk.c	\
 	kern/err.c kern/misc.c kern/parser.c kern/partition.c	\
@@ -117,7 +121,8 @@ grub_mkdevicemap_SOURCES = util/grub-mkdevicemap.c util/deviceiter.c \
 	util/devicemap.c util/misc.c
 
 # For grub-emu.
-util/grub-emu.c_DEPENDENCIES = grub_emu_init.h
+util/grub-emu.c.dep: grub_emu_init.h
+	$(TRUE)
 grub_emu_SOURCES = commands/minicmd.c commands/cat.c commands/cmp.c	\
 	commands/configfile.c commands/echo.c commands/help.c		\
 	commands/handler.c commands/ls.c commands/test.c 		\
conf/powerpc-ieee1275.rmk +4 -2
index af29d23..b5d3f13 100644
@@ -6,7 +6,8 @@ COMMON_CFLAGS = -ffreestanding
 COMMON_LDFLAGS += -nostdlib
 
 # Used by various components.  These rules need to precede them.
-script/sh/lexer.c_DEPENDENCIES = grub_script.tab.h
+script/sh/lexer.c.dep: grub_script.tab.h
+	$(TRUE)
 
 # Images.
 
@@ -39,7 +40,8 @@ grub_mkdevicemap_SOURCES = util/grub-mkdevicemap.c util/deviceiter.c \
 	util/devicemap.c util/misc.c
 
 # For grub-emu
-util/grub-emu.c_DEPENDENCIES = grub_emu_init.h
+util/grub-emu.c.dep: grub_emu_init.h
+	$(TRUE)
 grub_emu_SOURCES = commands/minicmd.c commands/cat.c commands/cmp.c 	\
 	commands/configfile.c commands/help.c				\
 	commands/search.c commands/handler.c commands/test.c 		\
conf/sparc64-ieee1275.rmk +8 -3
index aabccee..d2977b9 100644
@@ -6,7 +6,8 @@ COMMON_CFLAGS = -ffreestanding -m64 -mno-app-regs
 COMMON_LDFLAGS = -melf64_sparc -nostdlib -mno-relax
 
 # Used by various components.  These rules need to precede them.
-script/sh/lexer.c_DEPENDENCIES = grub_script.tab.h
+script/sh/lexer.c.dep: grub_script.tab.h
+	$(TRUE)
 
 # Images.
 pkglib_IMAGES = boot.img diskboot.img kernel.img
@@ -69,7 +70,9 @@ grub_mkimage_SOURCES = util/sparc64/ieee1275/grub-mkimage.c util/misc.c \
         util/resolve.c
 
 # For grub-setup.
-util/sparc64/ieee1275/grub-setup.c_DEPENDENCIES = grub_setup_init.h
+util/sparc64/ieee1275/grub-setup.c.dep: grub_setup_init.h
+	$(TRUE)
+
 grub_setup_SOURCES = util/sparc64/ieee1275/grub-setup.c util/hostdisk.c	\
 	util/misc.c util/getroot.c kern/device.c kern/disk.c	\
 	kern/err.c kern/misc.c kern/parser.c kern/partition.c	\
@@ -96,7 +99,9 @@ grub_ofpathname_SOURCES = util/sparc64/ieee1275/grub-ofpathname.c \
 	util/ieee1275/ofpath.c util/misc.c
 
 # For grub-emu
-util/grub-emu.c_DEPENDENCIES = grub_emu_init.h
+util/grub-emu.c.dep: grub_emu_init.h
+	$(TRUE)
+
 grub_emu_SOURCES = commands/minicmd.c commands/cat.c commands/cmp.c 	\
 	commands/configfile.c commands/help.c				\
 	commands/search.c commands/handler.c commands/test.c 		\
conf/x86_64-efi.rmk +5 -2
index 21da0e1..ac1a230 100644
@@ -5,7 +5,8 @@ COMMON_CFLAGS = -fno-builtin -m64
 COMMON_LDFLAGS = -melf_x86_64 -nostdlib
 
 # Used by various components.  These rules need to precede them.
-script/sh/lexer.c_DEPENDENCIES = grub_script.tab.h
+script/sh/lexer.c.dep: grub_script.tab.h
+	$(TRUE)
 
 # Utilities.
 bin_UTILITIES = grub-mkimage
@@ -30,7 +31,9 @@ grub_mkimage_SOURCES = util/i386/efi/grub-mkimage.c util/misc.c \
 grub_mkdevicemap_SOURCES = util/grub-mkdevicemap.c util/misc.c
 
 # For grub-emu.
-util/grub-emu.c_DEPENDENCIES = grub_emu_init.h
+util/grub-emu.c.dep: grub_emu_init.h
+	$(TRUE)
+
 grub_emu_SOURCES = commands/minicmd.c commands/cat.c commands/cmp.c 	\
 	commands/configfile.c commands/help.c				\
 	commands/handler.c commands/ls.c commands/test.c 		\