2002-12-27 08:53:07 +00:00
|
|
|
#! /usr/bin/ruby -w
|
|
|
|
#
|
2008-04-17 14:14:10 +00:00
|
|
|
# Copyright (C) 2002,2003,2004,2005,2006,2007,2008 Free Software Foundation, Inc.
|
2002-12-27 08:53:07 +00:00
|
|
|
#
|
|
|
|
# This genmk.rb is free software; the author
|
|
|
|
# gives unlimited permission to copy and/or distribute it,
|
|
|
|
# with or without modifications, as long as this notice is preserved.
|
|
|
|
#
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
|
|
|
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
|
|
|
# PARTICULAR PURPOSE.
|
|
|
|
|
|
|
|
module Enumerable
|
|
|
|
def collect_with_index
|
|
|
|
ret = []
|
|
|
|
self.each_with_index do |item, index|
|
|
|
|
ret.push(yield(item, index))
|
|
|
|
end
|
|
|
|
ret
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
class String
|
|
|
|
def to_var
|
|
|
|
self.gsub(/[^a-zA-Z0-9_@]/, '_')
|
|
|
|
end
|
|
|
|
|
|
|
|
def suffix(str)
|
|
|
|
self.sub(/\.[^\.]*$/, '') + '.' + str
|
|
|
|
end
|
|
|
|
|
|
|
|
def to_obj
|
|
|
|
self.sub(/\.[^\.]*$/, '').to_var + '.o'
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
class Image
|
|
|
|
def initialize(dir, name)
|
|
|
|
@dir = dir
|
|
|
|
@name = name
|
|
|
|
end
|
|
|
|
attr_reader :dir, :name
|
|
|
|
|
|
|
|
def rule(sources)
|
|
|
|
prefix = @name.to_var
|
|
|
|
exe = @name.suffix('exec')
|
|
|
|
objs = sources.collect do |src|
|
|
|
|
raise "unknown source file `#{src}'" if /\.[cS]$/ !~ src
|
|
|
|
prefix + '-' + src.to_obj
|
|
|
|
end
|
|
|
|
objs_str = objs.join(' ')
|
|
|
|
deps = objs.collect {|obj| obj.suffix('d')}
|
|
|
|
deps_str = deps.join(' ')
|
|
|
|
|
|
|
|
"CLEANFILES += #{@name} #{exe} #{objs_str}
|
|
|
|
MOSTLYCLEANFILES += #{deps_str}
|
|
|
|
|
|
|
|
#{@name}: #{exe}
|
2009-04-13 06:37:50 +00:00
|
|
|
$(OBJCOPY) -O $(#{prefix}_FORMAT) --strip-unneeded -R .note -R .comment -R .note.gnu.build-id $< $@
|
2002-12-27 08:53:07 +00:00
|
|
|
|
|
|
|
#{exe}: #{objs_str}
|
2006-05-29 Yoshinori K. Okuji <okuji@enbug.org>
* util/powerpc/ieee1275/grub-install.in (host_cpu): Removed.
(target_cpu): New variable.
(pkglibdir): Use target_cpu instead of host_cpu.
* util/i386/pc/grub-install.in (host_cpu): Removed.
(target_cpu): New variable.
(pkglibdir): Use target_cpu instead of host_cpu.
* util/genmoddep.c: Removed.
* kern/efi/mm.c (filter_memory_map): Use GRUB_CPU_SIZEOF_VOID_P
instead of GRUB_HOST_SIZEOF_VOID_P.
* kern/dl.c: Likewise.
* include/grub/i386/types.h (GRUB_HOST_SIZEOF_VOID_P): Renamed to
...
(GRUB_TARGET_SIZEOF_VOID_P): ... this.
(GRUB_HOST_SIZEOF_LONG): Renamed to ...
(GRUB_TARGET_SIZEOF_LONG): ... this.
(GRUB_HOST_WORDS_BIGENDIAN): Renamed to ...
(GRUB_TARGET_WORDS_BIGENDIAN): ... this.
* include/grub/powerpc/types.h (GRUB_HOST_SIZEOF_VOID_P): Renamed
to ...
(GRUB_TARGET_SIZEOF_VOID_P): ... this.
(GRUB_HOST_SIZEOF_LONG): Renamed to ...
(GRUB_TARGET_SIZEOF_LONG): ... this.
(GRUB_HOST_WORDS_BIGENDIAN): Renamed to ...
(GRUB_TARGET_WORDS_BIGENDIAN): ... this.
* include/grub/sparc64/types.h (GRUB_HOST_SIZEOF_VOID_P): Renamed
to ...
(GRUB_TARGET_SIZEOF_VOID_P): ... this.
(GRUB_HOST_SIZEOF_LONG): Renamed to ...
(GRUB_TARGET_SIZEOF_LONG): ... this.
(GRUB_HOST_WORDS_BIGENDIAN): Renamed to ...
(GRUB_TARGET_WORDS_BIGENDIAN): ... this.
* include/grub/types.h [!GRUB_UTIL] (GRUB_CPU_SIZEOF_VOID_P): Use
GRUB_TARGET_SIZEOF_VOID_P instead of GRUB_HOST_SIZEOF_VOID_P.
[!GRUB_UTIL] (GRUB_CPU_SIZEOF_LONG): Use GRUB_TARGET_SIZEOF_LONG
instead of GRUB_HOST_SIZEOF_LONG.
[!GRUB_UTIL]: Refer to GRUB_TARGET_WORDS_BIGENDIAN instead of
GRUB_HOST_WORDS_BIGENDIAN to define or undefine
GRUB_CPU_WORDS_BIGENDIAN.
Refer to SIZEOF_VOID_P instead of GRUB_HOST_SIZEOF_VOID_P to
define grub_host_addr_t, grub_host_off_t, grub_host_size_t and
grub_host_ssize_t.
* conf/i386-efi.rmk (noinst_UTILITIES): Removed.
(genmoddep_SOURCES): Likewise.
* conf/i386-pc.rmk (noinst_UTILITIES): Likewise.
(genmoddep_SOURCES): Likewise.
* conf/conf/powerpc-ieee1275.rmk (noinst_UTILITIES): Likewise.
(genmoddep_SOURCES): Likewise.
* conf/conf/conf/sparc64-ieee1275.rmk (noinst_UTILITIES):
Likewise.
(genmoddep_SOURCES): Likewise.
* genmoddep.awk: New file.
* genmk.rb (Image::rule): Use TARGET_CC, TARGET_CPPFLAGS,
TARGET_CFLAGS, TARGET_ASFLAGS and TARGET_LDFLAGS instead of CC,
CPPFLAGS, CFLAGS, ASFLAGS and LDFLAGS, respectively.
(PModule::rule): Likewise.
(Program::rule): Likewise.
(Utility::rule): Use CC, CPPFLAGS, CFLAGS and LDFLAGS instead of
BUILD_CC, BUILD_CPPFLAGS, BUILD_CFLAGS and BUILD_LDFLAGS,
respectively.
* configure.ac: Rewritten intensively to use host and target
instead of build and host, respectively.
* Makefile.in (pkglibdir): Use target_cpu instead of host_cpu.
(host_cpu): Removed.
(target_cpu): New variable.
(CPPFLAGS): Added @CPPFLAGS@ and -DGRUB_LIBDIR=\"$(pkglibdir)\".
(BUILD_CC): Removed.
(BUILD_CFLAGS): Likewise.
(BUILD_CPPFLAGS): Likewise.
(TARGET_CC): New variable.
(TARGET_CFLAGS): Likewise.
(TARGET_CPPFLAGS): Likewise.
(TARGET_LDFLAGS): Likewise.
(AWK): Likewise.
(include): Use target_cpu instead of host_cpu.
(moddep.lst:): Use genmoddep.awk instead of genmoddep.
* DISTLIST: Added genmoddep.awk. Removed util/genmoddep.c.
2006-05-28 23:01:43 +00:00
|
|
|
$(TARGET_CC) -o $@ $^ $(TARGET_LDFLAGS) $(#{prefix}_LDFLAGS)
|
2002-12-27 08:53:07 +00:00
|
|
|
|
|
|
|
" + objs.collect_with_index do |obj, i|
|
|
|
|
src = sources[i]
|
|
|
|
fake_obj = File.basename(src).suffix('o')
|
|
|
|
dep = deps[i]
|
2006-05-31 00:28:03 +00:00
|
|
|
flag = if /\.c$/ =~ src then 'CFLAGS' else 'ASFLAGS' end
|
2002-12-27 08:53:07 +00:00
|
|
|
extra_flags = if /\.S$/ =~ src then '-DASM_FILE=1' else '' end
|
|
|
|
dir = File.dirname(src)
|
|
|
|
|
2008-02-01 15:45:17 +00:00
|
|
|
"#{obj}: #{src} $(#{src}_DEPENDENCIES)
|
2006-08-15 12:29:08 +00:00
|
|
|
$(TARGET_CC) -I#{dir} -I$(srcdir)/#{dir} $(TARGET_CPPFLAGS) #{extra_flags} $(TARGET_#{flag}) $(#{prefix}_#{flag}) -MD -c -o $@ $<
|
2002-12-27 08:53:07 +00:00
|
|
|
-include #{dep}
|
|
|
|
|
|
|
|
"
|
|
|
|
end.join('')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
# Use PModule instead Module, to avoid name conflicting.
|
|
|
|
class PModule
|
|
|
|
def initialize(dir, name)
|
|
|
|
@dir = dir
|
|
|
|
@name = name
|
|
|
|
end
|
|
|
|
attr_reader :dir, :name
|
|
|
|
|
|
|
|
def rule(sources)
|
|
|
|
prefix = @name.to_var
|
|
|
|
objs = sources.collect do |src|
|
|
|
|
raise "unknown source file `#{src}'" if /\.[cS]$/ !~ src
|
|
|
|
prefix + '-' + src.to_obj
|
|
|
|
end
|
|
|
|
objs_str = objs.join(' ')
|
|
|
|
deps = objs.collect {|obj| obj.suffix('d')}
|
|
|
|
deps_str = deps.join(' ')
|
|
|
|
pre_obj = 'pre-' + @name.suffix('o')
|
|
|
|
mod_src = 'mod-' + @name.suffix('c')
|
|
|
|
mod_obj = mod_src.suffix('o')
|
|
|
|
defsym = 'def-' + @name.suffix('lst')
|
|
|
|
undsym = 'und-' + @name.suffix('lst')
|
|
|
|
mod_name = File.basename(@name, '.mod')
|
2005-03-08 01:01:06 +00:00
|
|
|
symbolic_name = mod_name.sub(/\.[^\.]*$/, '')
|
2002-12-27 08:53:07 +00:00
|
|
|
|
2006-04-18 Yoshinori K. Okuji <okuji@enbug.org>
* DISTLIST: Added conf/i386-efi.mk, conf/i386-efi.rmk,
include/grub/efi/api.h, include/grub/efi/console_control.h,
include/grub/efi/efi.h, include/grub/efi/pe32.h,
include/grub/i386/efi/time.h, kern/efi/efi.c,
kern/i386/efi/init.c, kern/i386/efi/startup.S,
and util/i386/efi/grub-mkimage.c.
* Makefile.in (RMKFILES): Added i386-efi.rmk.
* genmk.rb (PModule#rule): Do not export symbols if
#{prefix}_EXPORTS is set to "no".
* conf/i386-efi.mk: New file.
* conf/i386-efi.rmk: Likewise.
* include/grub/efi/api.h: Likewise.
* include/grub/efi/console_control.h: Likewise.
* include/grub/efi/efi.h: Likewise.
* include/grub/efi/pe32.h: Likewise.
* include/grub/i386/efi/time.h: Likewise.
* kern/efi/efi.c: Likewise.
* kern/i386/efi/init.c: Likewise.
* kern/i386/efi/startup.S: Likewise.
* util/i386/efi/grub-mkimage.c: Likewise.
2006-04-18 06:18:15 +00:00
|
|
|
"CLEANFILES += #{@name} #{mod_obj} #{mod_src} #{pre_obj} #{objs_str} #{undsym}
|
|
|
|
ifneq ($(#{prefix}_EXPORTS),no)
|
|
|
|
CLEANFILES += #{defsym}
|
2002-12-27 08:53:07 +00:00
|
|
|
DEFSYMFILES += #{defsym}
|
2006-04-18 Yoshinori K. Okuji <okuji@enbug.org>
* DISTLIST: Added conf/i386-efi.mk, conf/i386-efi.rmk,
include/grub/efi/api.h, include/grub/efi/console_control.h,
include/grub/efi/efi.h, include/grub/efi/pe32.h,
include/grub/i386/efi/time.h, kern/efi/efi.c,
kern/i386/efi/init.c, kern/i386/efi/startup.S,
and util/i386/efi/grub-mkimage.c.
* Makefile.in (RMKFILES): Added i386-efi.rmk.
* genmk.rb (PModule#rule): Do not export symbols if
#{prefix}_EXPORTS is set to "no".
* conf/i386-efi.mk: New file.
* conf/i386-efi.rmk: Likewise.
* include/grub/efi/api.h: Likewise.
* include/grub/efi/console_control.h: Likewise.
* include/grub/efi/efi.h: Likewise.
* include/grub/efi/pe32.h: Likewise.
* include/grub/i386/efi/time.h: Likewise.
* kern/efi/efi.c: Likewise.
* kern/i386/efi/init.c: Likewise.
* kern/i386/efi/startup.S: Likewise.
* util/i386/efi/grub-mkimage.c: Likewise.
2006-04-18 06:18:15 +00:00
|
|
|
endif
|
|
|
|
MOSTLYCLEANFILES += #{deps_str}
|
2002-12-27 08:53:07 +00:00
|
|
|
UNDSYMFILES += #{undsym}
|
|
|
|
|
2008-07-24 14:56:30 +00:00
|
|
|
#{@name}: #{pre_obj} #{mod_obj} $(TARGET_OBJ2ELF)
|
2002-12-27 08:53:07 +00:00
|
|
|
-rm -f $@
|
2009-04-01 16:17:20 +00:00
|
|
|
$(TARGET_CC) $(#{prefix}_LDFLAGS) $(TARGET_LDFLAGS) -Wl,-r,-d -o $@ #{pre_obj} #{mod_obj}
|
2008-07-24 14:56:30 +00:00
|
|
|
if test ! -z $(TARGET_OBJ2ELF); then ./$(TARGET_OBJ2ELF) $@ || (rm -f $@; exit 1); fi
|
|
|
|
$(STRIP) --strip-unneeded -K grub_mod_init -K grub_mod_fini -K _grub_mod_init -K _grub_mod_fini -R .note -R .comment $@
|
2002-12-27 08:53:07 +00:00
|
|
|
|
2006-09-22 00:27:38 +00:00
|
|
|
#{pre_obj}: $(#{prefix}_DEPENDENCIES) #{objs_str}
|
2002-12-27 08:53:07 +00:00
|
|
|
-rm -f $@
|
2006-09-22 00:27:38 +00:00
|
|
|
$(TARGET_CC) $(#{prefix}_LDFLAGS) $(TARGET_LDFLAGS) -Wl,-r,-d -o $@ #{objs_str}
|
2002-12-27 08:53:07 +00:00
|
|
|
|
|
|
|
#{mod_obj}: #{mod_src}
|
2006-05-29 Yoshinori K. Okuji <okuji@enbug.org>
* util/powerpc/ieee1275/grub-install.in (host_cpu): Removed.
(target_cpu): New variable.
(pkglibdir): Use target_cpu instead of host_cpu.
* util/i386/pc/grub-install.in (host_cpu): Removed.
(target_cpu): New variable.
(pkglibdir): Use target_cpu instead of host_cpu.
* util/genmoddep.c: Removed.
* kern/efi/mm.c (filter_memory_map): Use GRUB_CPU_SIZEOF_VOID_P
instead of GRUB_HOST_SIZEOF_VOID_P.
* kern/dl.c: Likewise.
* include/grub/i386/types.h (GRUB_HOST_SIZEOF_VOID_P): Renamed to
...
(GRUB_TARGET_SIZEOF_VOID_P): ... this.
(GRUB_HOST_SIZEOF_LONG): Renamed to ...
(GRUB_TARGET_SIZEOF_LONG): ... this.
(GRUB_HOST_WORDS_BIGENDIAN): Renamed to ...
(GRUB_TARGET_WORDS_BIGENDIAN): ... this.
* include/grub/powerpc/types.h (GRUB_HOST_SIZEOF_VOID_P): Renamed
to ...
(GRUB_TARGET_SIZEOF_VOID_P): ... this.
(GRUB_HOST_SIZEOF_LONG): Renamed to ...
(GRUB_TARGET_SIZEOF_LONG): ... this.
(GRUB_HOST_WORDS_BIGENDIAN): Renamed to ...
(GRUB_TARGET_WORDS_BIGENDIAN): ... this.
* include/grub/sparc64/types.h (GRUB_HOST_SIZEOF_VOID_P): Renamed
to ...
(GRUB_TARGET_SIZEOF_VOID_P): ... this.
(GRUB_HOST_SIZEOF_LONG): Renamed to ...
(GRUB_TARGET_SIZEOF_LONG): ... this.
(GRUB_HOST_WORDS_BIGENDIAN): Renamed to ...
(GRUB_TARGET_WORDS_BIGENDIAN): ... this.
* include/grub/types.h [!GRUB_UTIL] (GRUB_CPU_SIZEOF_VOID_P): Use
GRUB_TARGET_SIZEOF_VOID_P instead of GRUB_HOST_SIZEOF_VOID_P.
[!GRUB_UTIL] (GRUB_CPU_SIZEOF_LONG): Use GRUB_TARGET_SIZEOF_LONG
instead of GRUB_HOST_SIZEOF_LONG.
[!GRUB_UTIL]: Refer to GRUB_TARGET_WORDS_BIGENDIAN instead of
GRUB_HOST_WORDS_BIGENDIAN to define or undefine
GRUB_CPU_WORDS_BIGENDIAN.
Refer to SIZEOF_VOID_P instead of GRUB_HOST_SIZEOF_VOID_P to
define grub_host_addr_t, grub_host_off_t, grub_host_size_t and
grub_host_ssize_t.
* conf/i386-efi.rmk (noinst_UTILITIES): Removed.
(genmoddep_SOURCES): Likewise.
* conf/i386-pc.rmk (noinst_UTILITIES): Likewise.
(genmoddep_SOURCES): Likewise.
* conf/conf/powerpc-ieee1275.rmk (noinst_UTILITIES): Likewise.
(genmoddep_SOURCES): Likewise.
* conf/conf/conf/sparc64-ieee1275.rmk (noinst_UTILITIES):
Likewise.
(genmoddep_SOURCES): Likewise.
* genmoddep.awk: New file.
* genmk.rb (Image::rule): Use TARGET_CC, TARGET_CPPFLAGS,
TARGET_CFLAGS, TARGET_ASFLAGS and TARGET_LDFLAGS instead of CC,
CPPFLAGS, CFLAGS, ASFLAGS and LDFLAGS, respectively.
(PModule::rule): Likewise.
(Program::rule): Likewise.
(Utility::rule): Use CC, CPPFLAGS, CFLAGS and LDFLAGS instead of
BUILD_CC, BUILD_CPPFLAGS, BUILD_CFLAGS and BUILD_LDFLAGS,
respectively.
* configure.ac: Rewritten intensively to use host and target
instead of build and host, respectively.
* Makefile.in (pkglibdir): Use target_cpu instead of host_cpu.
(host_cpu): Removed.
(target_cpu): New variable.
(CPPFLAGS): Added @CPPFLAGS@ and -DGRUB_LIBDIR=\"$(pkglibdir)\".
(BUILD_CC): Removed.
(BUILD_CFLAGS): Likewise.
(BUILD_CPPFLAGS): Likewise.
(TARGET_CC): New variable.
(TARGET_CFLAGS): Likewise.
(TARGET_CPPFLAGS): Likewise.
(TARGET_LDFLAGS): Likewise.
(AWK): Likewise.
(include): Use target_cpu instead of host_cpu.
(moddep.lst:): Use genmoddep.awk instead of genmoddep.
* DISTLIST: Added genmoddep.awk. Removed util/genmoddep.c.
2006-05-28 23:01:43 +00:00
|
|
|
$(TARGET_CC) $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(#{prefix}_CFLAGS) -c -o $@ $<
|
2002-12-27 08:53:07 +00:00
|
|
|
|
2008-11-01 17:44:47 +00:00
|
|
|
#{mod_src}: $(builddir)/moddep.lst $(srcdir)/genmodsrc.sh
|
2002-12-27 08:53:07 +00:00
|
|
|
sh $(srcdir)/genmodsrc.sh '#{mod_name}' $< > $@ || (rm -f $@; exit 1)
|
|
|
|
|
2006-04-18 Yoshinori K. Okuji <okuji@enbug.org>
* DISTLIST: Added conf/i386-efi.mk, conf/i386-efi.rmk,
include/grub/efi/api.h, include/grub/efi/console_control.h,
include/grub/efi/efi.h, include/grub/efi/pe32.h,
include/grub/i386/efi/time.h, kern/efi/efi.c,
kern/i386/efi/init.c, kern/i386/efi/startup.S,
and util/i386/efi/grub-mkimage.c.
* Makefile.in (RMKFILES): Added i386-efi.rmk.
* genmk.rb (PModule#rule): Do not export symbols if
#{prefix}_EXPORTS is set to "no".
* conf/i386-efi.mk: New file.
* conf/i386-efi.rmk: Likewise.
* include/grub/efi/api.h: Likewise.
* include/grub/efi/console_control.h: Likewise.
* include/grub/efi/efi.h: Likewise.
* include/grub/efi/pe32.h: Likewise.
* include/grub/i386/efi/time.h: Likewise.
* kern/efi/efi.c: Likewise.
* kern/i386/efi/init.c: Likewise.
* kern/i386/efi/startup.S: Likewise.
* util/i386/efi/grub-mkimage.c: Likewise.
2006-04-18 06:18:15 +00:00
|
|
|
ifneq ($(#{prefix}_EXPORTS),no)
|
2002-12-27 08:53:07 +00:00
|
|
|
#{defsym}: #{pre_obj}
|
|
|
|
$(NM) -g --defined-only -P -p $< | sed 's/^\\([^ ]*\\).*/\\1 #{mod_name}/' > $@
|
2006-04-18 Yoshinori K. Okuji <okuji@enbug.org>
* DISTLIST: Added conf/i386-efi.mk, conf/i386-efi.rmk,
include/grub/efi/api.h, include/grub/efi/console_control.h,
include/grub/efi/efi.h, include/grub/efi/pe32.h,
include/grub/i386/efi/time.h, kern/efi/efi.c,
kern/i386/efi/init.c, kern/i386/efi/startup.S,
and util/i386/efi/grub-mkimage.c.
* Makefile.in (RMKFILES): Added i386-efi.rmk.
* genmk.rb (PModule#rule): Do not export symbols if
#{prefix}_EXPORTS is set to "no".
* conf/i386-efi.mk: New file.
* conf/i386-efi.rmk: Likewise.
* include/grub/efi/api.h: Likewise.
* include/grub/efi/console_control.h: Likewise.
* include/grub/efi/efi.h: Likewise.
* include/grub/efi/pe32.h: Likewise.
* include/grub/i386/efi/time.h: Likewise.
* kern/efi/efi.c: Likewise.
* kern/i386/efi/init.c: Likewise.
* kern/i386/efi/startup.S: Likewise.
* util/i386/efi/grub-mkimage.c: Likewise.
2006-04-18 06:18:15 +00:00
|
|
|
endif
|
2002-12-27 08:53:07 +00:00
|
|
|
|
|
|
|
#{undsym}: #{pre_obj}
|
|
|
|
echo '#{mod_name}' > $@
|
2003-09-25 20:29:32 +00:00
|
|
|
$(NM) -u -P -p $< | cut -f1 -d' ' >> $@
|
2002-12-27 08:53:07 +00:00
|
|
|
|
|
|
|
" + objs.collect_with_index do |obj, i|
|
|
|
|
src = sources[i]
|
|
|
|
fake_obj = File.basename(src).suffix('o')
|
2005-11-18 Timothy Baldwin <T.E.Baldwin99@members.leeds.ac.uk>
* genmk.rb: Fixed list rules moved to Makefile.in. Recognise
appending to variables with "+=".
(PModule): Use full pathname to generate *.lst filenames.
* Makefile.in: Fixed list rules moved from genmk.rb.
(.DELETE_ON_ERROR): New special target.
(RMKFILES): Add common.rmk and sparc64-ieee1275.rmk.
* conf/i386-pc.rmk: Include conf/common.mk.
(pkgdata_MODULES): Removed fshelp.mod, fat.mod, ext2.mod, ufs.mod,
minux.mod, hfs.mod, jfs.mod, xfs.mod, affs.mod, sfs.mod,
hello.mod, boot.mod, terminal.mod, ls.mod, cmp.mod, cat.mod,
help.mod, font.mod, terminfo.mod, amiga.mod, apple.mod, pc.mod,
sun.mod, acorn.mod, loopback.mod, default.mod, timeout.mod,
configfile.mod, search.mod, gzio.mod and test.mod.
(symlist.c, grub_script.tab.c, grub_script.tab.h, kernel_syms.lst)
(grub_modules_init.lst, grub_modules_init.h, grub_emu_init.c)
(fshelp_mod_SOURCES, fshelp_mod_CFLAGS, fshelp_mod_LDFLAGS)
(fat_mod_SOURCES, fat_mod_CFLAGS, fat_mod_LDFLAGS)
(ext2_mod_SOURCES, ext2_mod_CFLAGS, ext2_mod_LDFLAGS)
(ufs_mod_SOURCES, ufs_mod_CFLAGS, ufs_mod_LDFLAGS)
(minix_mod_SOURCES, minix_mod_CFLAGS, minix_mod_LDFLAGS)
(hfs_mod_SOURCES, hfs_mod_CFLAGS, hfs_mod_LDFLAGS, jfs_mod_SOURCES)
(jfs_mod_CFLAGS, jfs_mod_LDFLAGS, iso9660_mod_SOURCES)
(iso9660_mod_CFLAGS, iso9660_mod_LDFLAGS, xfs_mod_SOURCES)
(xfs_mod_CFLAGS, xfs_mod_LDFLAGS, affs_mod_SOURCES)
(affs_mod_CFLAGS, affs_mod_LDFLAGS, sfs_mod_SOURCES)
(sfs_mod_CFLAGS, sfs_mod_LDFLAGS, hello_mod_SOURCES)
(hello_mod_CFLAGS, hello_mod_LDFLAGS, boot_mod_SOURCES)
(boot_mod_CFLAGS, boot_mod_LDFLAGS, terminal_mod_SOURCES)
(terminal_mod_CFLAGS, terminal_mod_LDFLAGS, ls_mod_SOURCES)
(ls_mod_CFLAGS, ls_mod_LDFLAGS, cmp_mod_SOURCES, cmp_mod_CFLAGS)
(cmp_mod_LDFLAGS, cat_mod_SOURCES, cat_mod_CFLAGS, cat_mod_LDFLAGS)
(help_mod_SOURCES, help_mod_CFLAGS, help_mod_LDFLAGS)
(font_mod_SOURCES, font_mod_CFLAGS, font_mod_LDFLAGS)
(terminfo_mod_SOURCES, terminfo_mod_CFLAGS, terminfo_mod_LDFLAGS)
(amiga_mod_SOURCES, amiga_mod_CFLAGS, amiga_mod_LDFLAGS)
(apple_mod_SOURCES, apple_mod_CFLAGS, apple_mod_LDFLAG): Move from
here...
* conf/common.rmk: ... to here. New file.
* conf/common.mk: New file.
2005-11-18 14:56:55 +00:00
|
|
|
command = 'cmd-' + obj.suffix('lst')
|
|
|
|
fs = 'fs-' + obj.suffix('lst')
|
2008-04-13 10:55:19 +00:00
|
|
|
partmap = 'partmap-' + obj.suffix('lst')
|
2009-04-14 18:12:14 +00:00
|
|
|
handler = 'handler-' + obj.suffix('lst')
|
2009-04-25 12:18:25 +00:00
|
|
|
parttool = 'parttool-' + obj.suffix('lst')
|
2002-12-27 08:53:07 +00:00
|
|
|
dep = deps[i]
|
2006-05-31 00:28:03 +00:00
|
|
|
flag = if /\.c$/ =~ src then 'CFLAGS' else 'ASFLAGS' end
|
2007-10-20 18:32:18 +00:00
|
|
|
extra_flags = if /\.S$/ =~ src then '-DASM_FILE=1' else '' end
|
2002-12-27 08:53:07 +00:00
|
|
|
dir = File.dirname(src)
|
|
|
|
|
2008-02-01 15:45:17 +00:00
|
|
|
"#{obj}: #{src} $(#{src}_DEPENDENCIES)
|
2007-10-20 18:32:18 +00:00
|
|
|
$(TARGET_CC) -I#{dir} -I$(srcdir)/#{dir} $(TARGET_CPPFLAGS) #{extra_flags} $(TARGET_#{flag}) $(#{prefix}_#{flag}) -MD -c -o $@ $<
|
2002-12-27 08:53:07 +00:00
|
|
|
-include #{dep}
|
|
|
|
|
2009-04-25 12:18:25 +00:00
|
|
|
CLEANFILES += #{command} #{fs} #{partmap} #{handler} #{parttool}
|
2005-03-02 21:52:38 +00:00
|
|
|
COMMANDFILES += #{command}
|
2005-07-03 18:06:56 +00:00
|
|
|
FSFILES += #{fs}
|
2009-04-25 12:18:25 +00:00
|
|
|
PARTTOOLFILES += #{parttool}
|
2008-04-13 10:55:19 +00:00
|
|
|
PARTMAPFILES += #{partmap}
|
2009-04-14 18:12:14 +00:00
|
|
|
HANDLERFILES += #{handler}
|
2005-03-02 21:52:38 +00:00
|
|
|
|
2008-02-01 15:45:17 +00:00
|
|
|
#{command}: #{src} $(#{src}_DEPENDENCIES) gencmdlist.sh
|
2005-03-02 21:52:38 +00:00
|
|
|
set -e; \
|
2009-03-24 14:01:23 +00:00
|
|
|
$(TARGET_CC) -I#{dir} -I$(srcdir)/#{dir} $(TARGET_CPPFLAGS) #{extra_flags} $(TARGET_#{flag}) $(#{prefix}_#{flag}) -E $< \
|
2005-03-08 01:01:06 +00:00
|
|
|
| sh $(srcdir)/gencmdlist.sh #{symbolic_name} > $@ || (rm -f $@; exit 1)
|
2005-03-02 21:52:38 +00:00
|
|
|
|
2008-02-01 15:45:17 +00:00
|
|
|
#{fs}: #{src} $(#{src}_DEPENDENCIES) genfslist.sh
|
2005-07-03 18:06:56 +00:00
|
|
|
set -e; \
|
2009-03-24 14:01:23 +00:00
|
|
|
$(TARGET_CC) -I#{dir} -I$(srcdir)/#{dir} $(TARGET_CPPFLAGS) #{extra_flags} $(TARGET_#{flag}) $(#{prefix}_#{flag}) -E $< \
|
2005-07-03 18:06:56 +00:00
|
|
|
| sh $(srcdir)/genfslist.sh #{symbolic_name} > $@ || (rm -f $@; exit 1)
|
|
|
|
|
2009-04-25 12:18:25 +00:00
|
|
|
#{parttool}: #{src} $(#{src}_DEPENDENCIES) genparttoollist.sh
|
|
|
|
set -e; \
|
|
|
|
$(TARGET_CC) -I#{dir} -I$(srcdir)/#{dir} $(TARGET_CPPFLAGS) #{extra_flags} $(TARGET_#{flag}) $(#{prefix}_#{flag}) -E $< \
|
|
|
|
| sh $(srcdir)/genparttoollist.sh #{symbolic_name} > $@ || (rm -f $@; exit 1)
|
|
|
|
|
2008-04-13 10:55:19 +00:00
|
|
|
#{partmap}: #{src} $(#{src}_DEPENDENCIES) genpartmaplist.sh
|
|
|
|
set -e; \
|
2009-03-24 14:01:23 +00:00
|
|
|
$(TARGET_CC) -I#{dir} -I$(srcdir)/#{dir} $(TARGET_CPPFLAGS) #{extra_flags} $(TARGET_#{flag}) $(#{prefix}_#{flag}) -E $< \
|
2008-04-13 10:55:19 +00:00
|
|
|
| sh $(srcdir)/genpartmaplist.sh #{symbolic_name} > $@ || (rm -f $@; exit 1)
|
|
|
|
|
2009-04-14 18:12:14 +00:00
|
|
|
#{handler}: #{src} $(#{src}_DEPENDENCIES) genhandlerlist.sh
|
|
|
|
set -e; \
|
|
|
|
$(TARGET_CC) -I#{dir} -I$(srcdir)/#{dir} $(TARGET_CPPFLAGS) #{extra_flags} $(TARGET_#{flag}) $(#{prefix}_#{flag}) -E $< \
|
|
|
|
| sh $(srcdir)/genhandlerlist.sh #{symbolic_name} > $@ || (rm -f $@; exit 1)
|
2005-07-03 18:06:56 +00:00
|
|
|
|
2002-12-27 08:53:07 +00:00
|
|
|
"
|
|
|
|
end.join('')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
class Utility
|
|
|
|
def initialize(dir, name)
|
|
|
|
@dir = dir
|
|
|
|
@name = name
|
|
|
|
end
|
|
|
|
attr_reader :dir, :name
|
|
|
|
|
|
|
|
def rule(sources)
|
|
|
|
prefix = @name.to_var
|
|
|
|
objs = sources.collect do |src|
|
2004-03-28 21:52:02 +00:00
|
|
|
raise "unknown source file `#{src}'" if /\.[cS]$/ !~ src
|
2002-12-27 08:53:07 +00:00
|
|
|
prefix + '-' + src.to_obj
|
|
|
|
end
|
|
|
|
objs_str = objs.join(' ');
|
|
|
|
deps = objs.collect {|obj| obj.suffix('d')}
|
|
|
|
deps_str = deps.join(' ');
|
|
|
|
|
2008-07-24 14:56:30 +00:00
|
|
|
"CLEANFILES += #{@name}$(EXEEXT) #{objs_str}
|
2002-12-27 08:53:07 +00:00
|
|
|
MOSTLYCLEANFILES += #{deps_str}
|
|
|
|
|
2006-09-22 00:27:38 +00:00
|
|
|
#{@name}: $(#{prefix}_DEPENDENCIES) #{objs_str}
|
|
|
|
$(CC) -o $@ #{objs_str} $(LDFLAGS) $(#{prefix}_LDFLAGS)
|
2002-12-27 08:53:07 +00:00
|
|
|
|
|
|
|
" + objs.collect_with_index do |obj, i|
|
|
|
|
src = sources[i]
|
|
|
|
fake_obj = File.basename(src).suffix('o')
|
|
|
|
dep = deps[i]
|
|
|
|
dir = File.dirname(src)
|
|
|
|
|
2007-08-29 10:39:42 +00:00
|
|
|
"#{obj}: #{src} $(#{src}_DEPENDENCIES)
|
2006-08-15 12:29:08 +00:00
|
|
|
$(CC) -I#{dir} -I$(srcdir)/#{dir} $(CPPFLAGS) $(CFLAGS) -DGRUB_UTIL=1 $(#{prefix}_CFLAGS) -MD -c -o $@ $<
|
2002-12-27 08:53:07 +00:00
|
|
|
-include #{dep}
|
|
|
|
|
|
|
|
"
|
|
|
|
end.join('')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2004-12-27 Marco Gerards <metgerards@student.han.nl>
* genmk.rb: Handle the `Program' class in the main loop. Written
by Johan Rydberg <jrydberg@gnu.org>.
(Program): New class.
(programs): New variable.
* boot/powerpc/ieee1275/cmain.c: Include <grub/machine/ieee1275.h>
instead of "grub/machine/ieee1275.h". Include <grub/kernel.h>
instead of "grub/kernel.h". Include <grub/machine/init.h>.
(help_arch): Function removed.
* conf/powerpc-ieee1275.rmk (grubof_HEADERS): Add
`powerpc/libgcc.h' and `loader.h'.
(pkgdata_PROGRAMS): New variable.
(sbin_UTILITIES): Variable removed.
(grub_emu_SOURCES): Added kern/powerpc/cache.S.
(grubof_SOURCES): Variable re-defined so it only includes the
core functionality.
(grubof_CFLAGS): Remove `-DGRUBOF'.
(pkgdata_MODULES, fshelp_mod_SOURCES, fshelp_mod_CFLAGS,
(fat_mod_SOURCES, fat_mod_CFLAGS, ext2_mod_SOURCES)
(ext2_mod_CFLAGS, ufs_mod_SOURCES, ufs_mod_CFLAGS)
(minix_mod_SOURCES, minix_mod_CFLAGS, hfs_mod_SOURCES)
(hfs_mod_CFLAGS, jfs_mod_SOURCES, jfs_mod_CFLAGS)
(iso9660_mod_SOURCES, iso9660_mod_CFLAGS, _linux_mod_SOURCES)
(_linux_mod_CFLAGS, linux_mod_SOURCES, linux_mod_CFLAGS)
(normal_mod_SOURCES, normal_mod_CFLAGS, normal_mod_ASFLAGS)
(hello_mod_SOURCES, hello_mod_CFLAGS, boot_mod_SOURCES)
(boot_mod_CFLAGS, terminal_mod_SOURCES, terminal_mod_CFLAGS)
(ls_mod_SOURCES, ls_mod_CFLAGS, cmp_mod_SOURCES, cmp_mod_CFLAGS)
(cat_mod_SOURCES, cat_mod_CFLAGS, font_mod_SOURCES)
(font_mod_CFLAGS, amiga_mod_SOURCES, amiga_mod_CFLAGS)
(apple_mod_SOURCES, apple_mod_CFLAGS, pc_mod_SOURCES)
(pc_mod_CFLAGS): New variables.
* disk/powerpc/ieee1275/ofdisk.c: Include <grub/machine/init.h>.
(grub_ofdisk_iterate): Add a prototype for `dev_iterate'.
* include/grub/dl.h (grub_arch_dl_sync_caches): New prototype.
* include/grub/loader.h (grub_os_area_addr, grub_os_area_size):
Moved from here...
* include/grub/i386/pc/init.h (grub_os_area_addr)
(rub_os_area_size): ... to here.
* include/grub/powerpc/ieee1275/ieee1275.h
(grub_ieee1275_entry_fn): Export symbol.
* include/grub/powerpc/ieee1275/init.h: New file.
* include/grub/powerpc/libgcc.h: Likewise.
* include/grub/cache.h: Likewise.
* kern/powerpc/cache.S: Likewise. Written by Hollis Blanchard
<hollis@penguinppc.org>.
* kern/dl.c: Include <grub/cache.h>.
(grub_dl_flush_cache): New function.
(grub_dl_load_core): Call `grub_dl_flush_cache' to flush the cache
for this module.
* kern/powerpc/ieee1275/init.c (grub_ofdisk_init)
(grub_console_init): Removed prototypes.
(grub_machine_init): Don't initialize the modules anymore.
* kern/powerpc/ieee1275/openfw.c (grub_map): Make the function
static.
* include/grub/powerpc/types.h (GRUB_HOST_WORDS_LITTLEENDIAN):
Macro undef removed.
(GRUB_HOST_WORDS_BIGENDIAN): New macro.
* kern/powerpc/dl.c (grub_arch_dl_relocate_symbols): Add
relocation `R_PPC_REL32'. Return an error when the relocation is
unknown.
* Makefile.in (DATA): Add `$(pkgdata_PROGRAMS)'.
* kern/i386/pc/init.c (grub_arch_sync_caches): New function.
* util/misc.c (grub_arch_sync_caches): Likewise.
2004-12-27 13:46:20 +00:00
|
|
|
class Program
|
|
|
|
def initialize(dir, name)
|
|
|
|
@dir = dir
|
|
|
|
@name = name
|
|
|
|
end
|
|
|
|
attr_reader :dir, :name
|
|
|
|
|
|
|
|
def rule(sources)
|
|
|
|
prefix = @name.to_var
|
|
|
|
objs = sources.collect do |src|
|
|
|
|
raise "unknown source file `#{src}'" if /\.[cS]$/ !~ src
|
|
|
|
prefix + '-' + src.to_obj
|
|
|
|
end
|
|
|
|
objs_str = objs.join(' ');
|
|
|
|
deps = objs.collect {|obj| obj.suffix('d')}
|
|
|
|
deps_str = deps.join(' ');
|
|
|
|
|
|
|
|
"CLEANFILES += #{@name} #{objs_str}
|
|
|
|
MOSTLYCLEANFILES += #{deps_str}
|
|
|
|
|
2006-09-22 00:27:38 +00:00
|
|
|
#{@name}: $(#{prefix}_DEPENDENCIES) #{objs_str}
|
|
|
|
$(TARGET_CC) -o $@ #{objs_str} $(TARGET_LDFLAGS) $(#{prefix}_LDFLAGS)
|
2004-12-27 Marco Gerards <metgerards@student.han.nl>
* genmk.rb: Handle the `Program' class in the main loop. Written
by Johan Rydberg <jrydberg@gnu.org>.
(Program): New class.
(programs): New variable.
* boot/powerpc/ieee1275/cmain.c: Include <grub/machine/ieee1275.h>
instead of "grub/machine/ieee1275.h". Include <grub/kernel.h>
instead of "grub/kernel.h". Include <grub/machine/init.h>.
(help_arch): Function removed.
* conf/powerpc-ieee1275.rmk (grubof_HEADERS): Add
`powerpc/libgcc.h' and `loader.h'.
(pkgdata_PROGRAMS): New variable.
(sbin_UTILITIES): Variable removed.
(grub_emu_SOURCES): Added kern/powerpc/cache.S.
(grubof_SOURCES): Variable re-defined so it only includes the
core functionality.
(grubof_CFLAGS): Remove `-DGRUBOF'.
(pkgdata_MODULES, fshelp_mod_SOURCES, fshelp_mod_CFLAGS,
(fat_mod_SOURCES, fat_mod_CFLAGS, ext2_mod_SOURCES)
(ext2_mod_CFLAGS, ufs_mod_SOURCES, ufs_mod_CFLAGS)
(minix_mod_SOURCES, minix_mod_CFLAGS, hfs_mod_SOURCES)
(hfs_mod_CFLAGS, jfs_mod_SOURCES, jfs_mod_CFLAGS)
(iso9660_mod_SOURCES, iso9660_mod_CFLAGS, _linux_mod_SOURCES)
(_linux_mod_CFLAGS, linux_mod_SOURCES, linux_mod_CFLAGS)
(normal_mod_SOURCES, normal_mod_CFLAGS, normal_mod_ASFLAGS)
(hello_mod_SOURCES, hello_mod_CFLAGS, boot_mod_SOURCES)
(boot_mod_CFLAGS, terminal_mod_SOURCES, terminal_mod_CFLAGS)
(ls_mod_SOURCES, ls_mod_CFLAGS, cmp_mod_SOURCES, cmp_mod_CFLAGS)
(cat_mod_SOURCES, cat_mod_CFLAGS, font_mod_SOURCES)
(font_mod_CFLAGS, amiga_mod_SOURCES, amiga_mod_CFLAGS)
(apple_mod_SOURCES, apple_mod_CFLAGS, pc_mod_SOURCES)
(pc_mod_CFLAGS): New variables.
* disk/powerpc/ieee1275/ofdisk.c: Include <grub/machine/init.h>.
(grub_ofdisk_iterate): Add a prototype for `dev_iterate'.
* include/grub/dl.h (grub_arch_dl_sync_caches): New prototype.
* include/grub/loader.h (grub_os_area_addr, grub_os_area_size):
Moved from here...
* include/grub/i386/pc/init.h (grub_os_area_addr)
(rub_os_area_size): ... to here.
* include/grub/powerpc/ieee1275/ieee1275.h
(grub_ieee1275_entry_fn): Export symbol.
* include/grub/powerpc/ieee1275/init.h: New file.
* include/grub/powerpc/libgcc.h: Likewise.
* include/grub/cache.h: Likewise.
* kern/powerpc/cache.S: Likewise. Written by Hollis Blanchard
<hollis@penguinppc.org>.
* kern/dl.c: Include <grub/cache.h>.
(grub_dl_flush_cache): New function.
(grub_dl_load_core): Call `grub_dl_flush_cache' to flush the cache
for this module.
* kern/powerpc/ieee1275/init.c (grub_ofdisk_init)
(grub_console_init): Removed prototypes.
(grub_machine_init): Don't initialize the modules anymore.
* kern/powerpc/ieee1275/openfw.c (grub_map): Make the function
static.
* include/grub/powerpc/types.h (GRUB_HOST_WORDS_LITTLEENDIAN):
Macro undef removed.
(GRUB_HOST_WORDS_BIGENDIAN): New macro.
* kern/powerpc/dl.c (grub_arch_dl_relocate_symbols): Add
relocation `R_PPC_REL32'. Return an error when the relocation is
unknown.
* Makefile.in (DATA): Add `$(pkgdata_PROGRAMS)'.
* kern/i386/pc/init.c (grub_arch_sync_caches): New function.
* util/misc.c (grub_arch_sync_caches): Likewise.
2004-12-27 13:46:20 +00:00
|
|
|
|
|
|
|
" + objs.collect_with_index do |obj, i|
|
|
|
|
src = sources[i]
|
|
|
|
fake_obj = File.basename(src).suffix('o')
|
|
|
|
dep = deps[i]
|
|
|
|
dir = File.dirname(src)
|
|
|
|
|
2008-02-01 15:45:17 +00:00
|
|
|
"#{obj}: #{src} $(#{src}_DEPENDENCIES)
|
2006-08-15 12:29:08 +00:00
|
|
|
$(TARGET_CC) -I#{dir} -I$(srcdir)/#{dir} $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) $(#{prefix}_CFLAGS) -MD -c -o $@ $<
|
2004-12-27 Marco Gerards <metgerards@student.han.nl>
* genmk.rb: Handle the `Program' class in the main loop. Written
by Johan Rydberg <jrydberg@gnu.org>.
(Program): New class.
(programs): New variable.
* boot/powerpc/ieee1275/cmain.c: Include <grub/machine/ieee1275.h>
instead of "grub/machine/ieee1275.h". Include <grub/kernel.h>
instead of "grub/kernel.h". Include <grub/machine/init.h>.
(help_arch): Function removed.
* conf/powerpc-ieee1275.rmk (grubof_HEADERS): Add
`powerpc/libgcc.h' and `loader.h'.
(pkgdata_PROGRAMS): New variable.
(sbin_UTILITIES): Variable removed.
(grub_emu_SOURCES): Added kern/powerpc/cache.S.
(grubof_SOURCES): Variable re-defined so it only includes the
core functionality.
(grubof_CFLAGS): Remove `-DGRUBOF'.
(pkgdata_MODULES, fshelp_mod_SOURCES, fshelp_mod_CFLAGS,
(fat_mod_SOURCES, fat_mod_CFLAGS, ext2_mod_SOURCES)
(ext2_mod_CFLAGS, ufs_mod_SOURCES, ufs_mod_CFLAGS)
(minix_mod_SOURCES, minix_mod_CFLAGS, hfs_mod_SOURCES)
(hfs_mod_CFLAGS, jfs_mod_SOURCES, jfs_mod_CFLAGS)
(iso9660_mod_SOURCES, iso9660_mod_CFLAGS, _linux_mod_SOURCES)
(_linux_mod_CFLAGS, linux_mod_SOURCES, linux_mod_CFLAGS)
(normal_mod_SOURCES, normal_mod_CFLAGS, normal_mod_ASFLAGS)
(hello_mod_SOURCES, hello_mod_CFLAGS, boot_mod_SOURCES)
(boot_mod_CFLAGS, terminal_mod_SOURCES, terminal_mod_CFLAGS)
(ls_mod_SOURCES, ls_mod_CFLAGS, cmp_mod_SOURCES, cmp_mod_CFLAGS)
(cat_mod_SOURCES, cat_mod_CFLAGS, font_mod_SOURCES)
(font_mod_CFLAGS, amiga_mod_SOURCES, amiga_mod_CFLAGS)
(apple_mod_SOURCES, apple_mod_CFLAGS, pc_mod_SOURCES)
(pc_mod_CFLAGS): New variables.
* disk/powerpc/ieee1275/ofdisk.c: Include <grub/machine/init.h>.
(grub_ofdisk_iterate): Add a prototype for `dev_iterate'.
* include/grub/dl.h (grub_arch_dl_sync_caches): New prototype.
* include/grub/loader.h (grub_os_area_addr, grub_os_area_size):
Moved from here...
* include/grub/i386/pc/init.h (grub_os_area_addr)
(rub_os_area_size): ... to here.
* include/grub/powerpc/ieee1275/ieee1275.h
(grub_ieee1275_entry_fn): Export symbol.
* include/grub/powerpc/ieee1275/init.h: New file.
* include/grub/powerpc/libgcc.h: Likewise.
* include/grub/cache.h: Likewise.
* kern/powerpc/cache.S: Likewise. Written by Hollis Blanchard
<hollis@penguinppc.org>.
* kern/dl.c: Include <grub/cache.h>.
(grub_dl_flush_cache): New function.
(grub_dl_load_core): Call `grub_dl_flush_cache' to flush the cache
for this module.
* kern/powerpc/ieee1275/init.c (grub_ofdisk_init)
(grub_console_init): Removed prototypes.
(grub_machine_init): Don't initialize the modules anymore.
* kern/powerpc/ieee1275/openfw.c (grub_map): Make the function
static.
* include/grub/powerpc/types.h (GRUB_HOST_WORDS_LITTLEENDIAN):
Macro undef removed.
(GRUB_HOST_WORDS_BIGENDIAN): New macro.
* kern/powerpc/dl.c (grub_arch_dl_relocate_symbols): Add
relocation `R_PPC_REL32'. Return an error when the relocation is
unknown.
* Makefile.in (DATA): Add `$(pkgdata_PROGRAMS)'.
* kern/i386/pc/init.c (grub_arch_sync_caches): New function.
* util/misc.c (grub_arch_sync_caches): Likewise.
2004-12-27 13:46:20 +00:00
|
|
|
-include #{dep}
|
|
|
|
|
|
|
|
"
|
|
|
|
end.join('')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2005-07-24 18:16:26 +00:00
|
|
|
class Script
|
|
|
|
def initialize(dir, name)
|
|
|
|
@dir = dir
|
|
|
|
@name = name
|
|
|
|
end
|
|
|
|
attr_reader :dir, :name
|
|
|
|
|
|
|
|
def rule(sources)
|
|
|
|
if sources.length != 1
|
|
|
|
raise "only a single source file must be specified for a script"
|
|
|
|
end
|
|
|
|
src = sources[0]
|
|
|
|
if /\.in$/ !~ src
|
|
|
|
raise "unknown source file `#{src}'"
|
|
|
|
end
|
|
|
|
|
|
|
|
"CLEANFILES += #{@name}
|
|
|
|
|
2008-02-01 15:45:17 +00:00
|
|
|
#{@name}: #{src} $(#{src}_DEPENDENCIES) config.status
|
2005-07-24 18:16:26 +00:00
|
|
|
./config.status --file=#{name}:#{src}
|
2005-08-07 17:12:52 +00:00
|
|
|
chmod +x $@
|
2005-07-24 18:16:26 +00:00
|
|
|
|
|
|
|
"
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2002-12-27 08:53:07 +00:00
|
|
|
images = []
|
|
|
|
utils = []
|
|
|
|
pmodules = []
|
2004-12-27 Marco Gerards <metgerards@student.han.nl>
* genmk.rb: Handle the `Program' class in the main loop. Written
by Johan Rydberg <jrydberg@gnu.org>.
(Program): New class.
(programs): New variable.
* boot/powerpc/ieee1275/cmain.c: Include <grub/machine/ieee1275.h>
instead of "grub/machine/ieee1275.h". Include <grub/kernel.h>
instead of "grub/kernel.h". Include <grub/machine/init.h>.
(help_arch): Function removed.
* conf/powerpc-ieee1275.rmk (grubof_HEADERS): Add
`powerpc/libgcc.h' and `loader.h'.
(pkgdata_PROGRAMS): New variable.
(sbin_UTILITIES): Variable removed.
(grub_emu_SOURCES): Added kern/powerpc/cache.S.
(grubof_SOURCES): Variable re-defined so it only includes the
core functionality.
(grubof_CFLAGS): Remove `-DGRUBOF'.
(pkgdata_MODULES, fshelp_mod_SOURCES, fshelp_mod_CFLAGS,
(fat_mod_SOURCES, fat_mod_CFLAGS, ext2_mod_SOURCES)
(ext2_mod_CFLAGS, ufs_mod_SOURCES, ufs_mod_CFLAGS)
(minix_mod_SOURCES, minix_mod_CFLAGS, hfs_mod_SOURCES)
(hfs_mod_CFLAGS, jfs_mod_SOURCES, jfs_mod_CFLAGS)
(iso9660_mod_SOURCES, iso9660_mod_CFLAGS, _linux_mod_SOURCES)
(_linux_mod_CFLAGS, linux_mod_SOURCES, linux_mod_CFLAGS)
(normal_mod_SOURCES, normal_mod_CFLAGS, normal_mod_ASFLAGS)
(hello_mod_SOURCES, hello_mod_CFLAGS, boot_mod_SOURCES)
(boot_mod_CFLAGS, terminal_mod_SOURCES, terminal_mod_CFLAGS)
(ls_mod_SOURCES, ls_mod_CFLAGS, cmp_mod_SOURCES, cmp_mod_CFLAGS)
(cat_mod_SOURCES, cat_mod_CFLAGS, font_mod_SOURCES)
(font_mod_CFLAGS, amiga_mod_SOURCES, amiga_mod_CFLAGS)
(apple_mod_SOURCES, apple_mod_CFLAGS, pc_mod_SOURCES)
(pc_mod_CFLAGS): New variables.
* disk/powerpc/ieee1275/ofdisk.c: Include <grub/machine/init.h>.
(grub_ofdisk_iterate): Add a prototype for `dev_iterate'.
* include/grub/dl.h (grub_arch_dl_sync_caches): New prototype.
* include/grub/loader.h (grub_os_area_addr, grub_os_area_size):
Moved from here...
* include/grub/i386/pc/init.h (grub_os_area_addr)
(rub_os_area_size): ... to here.
* include/grub/powerpc/ieee1275/ieee1275.h
(grub_ieee1275_entry_fn): Export symbol.
* include/grub/powerpc/ieee1275/init.h: New file.
* include/grub/powerpc/libgcc.h: Likewise.
* include/grub/cache.h: Likewise.
* kern/powerpc/cache.S: Likewise. Written by Hollis Blanchard
<hollis@penguinppc.org>.
* kern/dl.c: Include <grub/cache.h>.
(grub_dl_flush_cache): New function.
(grub_dl_load_core): Call `grub_dl_flush_cache' to flush the cache
for this module.
* kern/powerpc/ieee1275/init.c (grub_ofdisk_init)
(grub_console_init): Removed prototypes.
(grub_machine_init): Don't initialize the modules anymore.
* kern/powerpc/ieee1275/openfw.c (grub_map): Make the function
static.
* include/grub/powerpc/types.h (GRUB_HOST_WORDS_LITTLEENDIAN):
Macro undef removed.
(GRUB_HOST_WORDS_BIGENDIAN): New macro.
* kern/powerpc/dl.c (grub_arch_dl_relocate_symbols): Add
relocation `R_PPC_REL32'. Return an error when the relocation is
unknown.
* Makefile.in (DATA): Add `$(pkgdata_PROGRAMS)'.
* kern/i386/pc/init.c (grub_arch_sync_caches): New function.
* util/misc.c (grub_arch_sync_caches): Likewise.
2004-12-27 13:46:20 +00:00
|
|
|
programs = []
|
2005-07-24 18:16:26 +00:00
|
|
|
scripts = []
|
2002-12-27 08:53:07 +00:00
|
|
|
|
2008-07-28 22:35:40 +00:00
|
|
|
l = gets
|
|
|
|
print l
|
|
|
|
print "# Generated by genmk.rb, please don't edit!\n"
|
|
|
|
|
2002-12-27 08:53:07 +00:00
|
|
|
cont = false
|
2009-05-26 23:19:42 +00:00
|
|
|
str = nil
|
2002-12-27 08:53:07 +00:00
|
|
|
while l = gets
|
|
|
|
if cont
|
2009-05-26 23:19:42 +00:00
|
|
|
str += l
|
2002-12-27 08:53:07 +00:00
|
|
|
else
|
2009-05-26 23:19:42 +00:00
|
|
|
str = l
|
2002-12-27 08:53:07 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
print l
|
|
|
|
cont = (/\\$/ =~ l)
|
|
|
|
unless cont
|
2009-05-26 23:19:42 +00:00
|
|
|
str.gsub!(/\\\n/, ' ')
|
2002-12-27 08:53:07 +00:00
|
|
|
|
2009-05-26 23:19:42 +00:00
|
|
|
if /^([a-zA-Z0-9_]+)\s*\+?=\s*(.*?)\s*$/ =~ str
|
2002-12-27 08:53:07 +00:00
|
|
|
var, args = $1, $2
|
|
|
|
|
|
|
|
if var =~ /^([a-zA-Z0-9_]+)_([A-Z]+)$/
|
|
|
|
prefix, type = $1, $2
|
|
|
|
|
|
|
|
case type
|
|
|
|
when 'IMAGES'
|
|
|
|
images += args.split(/\s+/).collect do |img|
|
|
|
|
Image.new(prefix, img)
|
|
|
|
end
|
|
|
|
|
|
|
|
when 'MODULES'
|
|
|
|
pmodules += args.split(/\s+/).collect do |pmod|
|
|
|
|
PModule.new(prefix, pmod)
|
|
|
|
end
|
|
|
|
|
|
|
|
when 'UTILITIES'
|
|
|
|
utils += args.split(/\s+/).collect do |util|
|
|
|
|
Utility.new(prefix, util)
|
|
|
|
end
|
|
|
|
|
2004-12-27 Marco Gerards <metgerards@student.han.nl>
* genmk.rb: Handle the `Program' class in the main loop. Written
by Johan Rydberg <jrydberg@gnu.org>.
(Program): New class.
(programs): New variable.
* boot/powerpc/ieee1275/cmain.c: Include <grub/machine/ieee1275.h>
instead of "grub/machine/ieee1275.h". Include <grub/kernel.h>
instead of "grub/kernel.h". Include <grub/machine/init.h>.
(help_arch): Function removed.
* conf/powerpc-ieee1275.rmk (grubof_HEADERS): Add
`powerpc/libgcc.h' and `loader.h'.
(pkgdata_PROGRAMS): New variable.
(sbin_UTILITIES): Variable removed.
(grub_emu_SOURCES): Added kern/powerpc/cache.S.
(grubof_SOURCES): Variable re-defined so it only includes the
core functionality.
(grubof_CFLAGS): Remove `-DGRUBOF'.
(pkgdata_MODULES, fshelp_mod_SOURCES, fshelp_mod_CFLAGS,
(fat_mod_SOURCES, fat_mod_CFLAGS, ext2_mod_SOURCES)
(ext2_mod_CFLAGS, ufs_mod_SOURCES, ufs_mod_CFLAGS)
(minix_mod_SOURCES, minix_mod_CFLAGS, hfs_mod_SOURCES)
(hfs_mod_CFLAGS, jfs_mod_SOURCES, jfs_mod_CFLAGS)
(iso9660_mod_SOURCES, iso9660_mod_CFLAGS, _linux_mod_SOURCES)
(_linux_mod_CFLAGS, linux_mod_SOURCES, linux_mod_CFLAGS)
(normal_mod_SOURCES, normal_mod_CFLAGS, normal_mod_ASFLAGS)
(hello_mod_SOURCES, hello_mod_CFLAGS, boot_mod_SOURCES)
(boot_mod_CFLAGS, terminal_mod_SOURCES, terminal_mod_CFLAGS)
(ls_mod_SOURCES, ls_mod_CFLAGS, cmp_mod_SOURCES, cmp_mod_CFLAGS)
(cat_mod_SOURCES, cat_mod_CFLAGS, font_mod_SOURCES)
(font_mod_CFLAGS, amiga_mod_SOURCES, amiga_mod_CFLAGS)
(apple_mod_SOURCES, apple_mod_CFLAGS, pc_mod_SOURCES)
(pc_mod_CFLAGS): New variables.
* disk/powerpc/ieee1275/ofdisk.c: Include <grub/machine/init.h>.
(grub_ofdisk_iterate): Add a prototype for `dev_iterate'.
* include/grub/dl.h (grub_arch_dl_sync_caches): New prototype.
* include/grub/loader.h (grub_os_area_addr, grub_os_area_size):
Moved from here...
* include/grub/i386/pc/init.h (grub_os_area_addr)
(rub_os_area_size): ... to here.
* include/grub/powerpc/ieee1275/ieee1275.h
(grub_ieee1275_entry_fn): Export symbol.
* include/grub/powerpc/ieee1275/init.h: New file.
* include/grub/powerpc/libgcc.h: Likewise.
* include/grub/cache.h: Likewise.
* kern/powerpc/cache.S: Likewise. Written by Hollis Blanchard
<hollis@penguinppc.org>.
* kern/dl.c: Include <grub/cache.h>.
(grub_dl_flush_cache): New function.
(grub_dl_load_core): Call `grub_dl_flush_cache' to flush the cache
for this module.
* kern/powerpc/ieee1275/init.c (grub_ofdisk_init)
(grub_console_init): Removed prototypes.
(grub_machine_init): Don't initialize the modules anymore.
* kern/powerpc/ieee1275/openfw.c (grub_map): Make the function
static.
* include/grub/powerpc/types.h (GRUB_HOST_WORDS_LITTLEENDIAN):
Macro undef removed.
(GRUB_HOST_WORDS_BIGENDIAN): New macro.
* kern/powerpc/dl.c (grub_arch_dl_relocate_symbols): Add
relocation `R_PPC_REL32'. Return an error when the relocation is
unknown.
* Makefile.in (DATA): Add `$(pkgdata_PROGRAMS)'.
* kern/i386/pc/init.c (grub_arch_sync_caches): New function.
* util/misc.c (grub_arch_sync_caches): Likewise.
2004-12-27 13:46:20 +00:00
|
|
|
when 'PROGRAMS'
|
2005-07-24 18:16:26 +00:00
|
|
|
programs += args.split(/\s+/).collect do |prog|
|
|
|
|
Program.new(prefix, prog)
|
|
|
|
end
|
|
|
|
|
|
|
|
when 'SCRIPTS'
|
|
|
|
scripts += args.split(/\s+/).collect do |script|
|
|
|
|
Script.new(prefix, script)
|
2004-12-27 Marco Gerards <metgerards@student.han.nl>
* genmk.rb: Handle the `Program' class in the main loop. Written
by Johan Rydberg <jrydberg@gnu.org>.
(Program): New class.
(programs): New variable.
* boot/powerpc/ieee1275/cmain.c: Include <grub/machine/ieee1275.h>
instead of "grub/machine/ieee1275.h". Include <grub/kernel.h>
instead of "grub/kernel.h". Include <grub/machine/init.h>.
(help_arch): Function removed.
* conf/powerpc-ieee1275.rmk (grubof_HEADERS): Add
`powerpc/libgcc.h' and `loader.h'.
(pkgdata_PROGRAMS): New variable.
(sbin_UTILITIES): Variable removed.
(grub_emu_SOURCES): Added kern/powerpc/cache.S.
(grubof_SOURCES): Variable re-defined so it only includes the
core functionality.
(grubof_CFLAGS): Remove `-DGRUBOF'.
(pkgdata_MODULES, fshelp_mod_SOURCES, fshelp_mod_CFLAGS,
(fat_mod_SOURCES, fat_mod_CFLAGS, ext2_mod_SOURCES)
(ext2_mod_CFLAGS, ufs_mod_SOURCES, ufs_mod_CFLAGS)
(minix_mod_SOURCES, minix_mod_CFLAGS, hfs_mod_SOURCES)
(hfs_mod_CFLAGS, jfs_mod_SOURCES, jfs_mod_CFLAGS)
(iso9660_mod_SOURCES, iso9660_mod_CFLAGS, _linux_mod_SOURCES)
(_linux_mod_CFLAGS, linux_mod_SOURCES, linux_mod_CFLAGS)
(normal_mod_SOURCES, normal_mod_CFLAGS, normal_mod_ASFLAGS)
(hello_mod_SOURCES, hello_mod_CFLAGS, boot_mod_SOURCES)
(boot_mod_CFLAGS, terminal_mod_SOURCES, terminal_mod_CFLAGS)
(ls_mod_SOURCES, ls_mod_CFLAGS, cmp_mod_SOURCES, cmp_mod_CFLAGS)
(cat_mod_SOURCES, cat_mod_CFLAGS, font_mod_SOURCES)
(font_mod_CFLAGS, amiga_mod_SOURCES, amiga_mod_CFLAGS)
(apple_mod_SOURCES, apple_mod_CFLAGS, pc_mod_SOURCES)
(pc_mod_CFLAGS): New variables.
* disk/powerpc/ieee1275/ofdisk.c: Include <grub/machine/init.h>.
(grub_ofdisk_iterate): Add a prototype for `dev_iterate'.
* include/grub/dl.h (grub_arch_dl_sync_caches): New prototype.
* include/grub/loader.h (grub_os_area_addr, grub_os_area_size):
Moved from here...
* include/grub/i386/pc/init.h (grub_os_area_addr)
(rub_os_area_size): ... to here.
* include/grub/powerpc/ieee1275/ieee1275.h
(grub_ieee1275_entry_fn): Export symbol.
* include/grub/powerpc/ieee1275/init.h: New file.
* include/grub/powerpc/libgcc.h: Likewise.
* include/grub/cache.h: Likewise.
* kern/powerpc/cache.S: Likewise. Written by Hollis Blanchard
<hollis@penguinppc.org>.
* kern/dl.c: Include <grub/cache.h>.
(grub_dl_flush_cache): New function.
(grub_dl_load_core): Call `grub_dl_flush_cache' to flush the cache
for this module.
* kern/powerpc/ieee1275/init.c (grub_ofdisk_init)
(grub_console_init): Removed prototypes.
(grub_machine_init): Don't initialize the modules anymore.
* kern/powerpc/ieee1275/openfw.c (grub_map): Make the function
static.
* include/grub/powerpc/types.h (GRUB_HOST_WORDS_LITTLEENDIAN):
Macro undef removed.
(GRUB_HOST_WORDS_BIGENDIAN): New macro.
* kern/powerpc/dl.c (grub_arch_dl_relocate_symbols): Add
relocation `R_PPC_REL32'. Return an error when the relocation is
unknown.
* Makefile.in (DATA): Add `$(pkgdata_PROGRAMS)'.
* kern/i386/pc/init.c (grub_arch_sync_caches): New function.
* util/misc.c (grub_arch_sync_caches): Likewise.
2004-12-27 13:46:20 +00:00
|
|
|
end
|
|
|
|
|
2002-12-27 08:53:07 +00:00
|
|
|
when 'SOURCES'
|
|
|
|
if img = images.detect() {|i| i.name.to_var == prefix}
|
|
|
|
print img.rule(args.split(/\s+/))
|
|
|
|
elsif pmod = pmodules.detect() {|m| m.name.to_var == prefix}
|
|
|
|
print pmod.rule(args.split(/\s+/))
|
|
|
|
elsif util = utils.detect() {|u| u.name.to_var == prefix}
|
|
|
|
print util.rule(args.split(/\s+/))
|
2004-12-27 Marco Gerards <metgerards@student.han.nl>
* genmk.rb: Handle the `Program' class in the main loop. Written
by Johan Rydberg <jrydberg@gnu.org>.
(Program): New class.
(programs): New variable.
* boot/powerpc/ieee1275/cmain.c: Include <grub/machine/ieee1275.h>
instead of "grub/machine/ieee1275.h". Include <grub/kernel.h>
instead of "grub/kernel.h". Include <grub/machine/init.h>.
(help_arch): Function removed.
* conf/powerpc-ieee1275.rmk (grubof_HEADERS): Add
`powerpc/libgcc.h' and `loader.h'.
(pkgdata_PROGRAMS): New variable.
(sbin_UTILITIES): Variable removed.
(grub_emu_SOURCES): Added kern/powerpc/cache.S.
(grubof_SOURCES): Variable re-defined so it only includes the
core functionality.
(grubof_CFLAGS): Remove `-DGRUBOF'.
(pkgdata_MODULES, fshelp_mod_SOURCES, fshelp_mod_CFLAGS,
(fat_mod_SOURCES, fat_mod_CFLAGS, ext2_mod_SOURCES)
(ext2_mod_CFLAGS, ufs_mod_SOURCES, ufs_mod_CFLAGS)
(minix_mod_SOURCES, minix_mod_CFLAGS, hfs_mod_SOURCES)
(hfs_mod_CFLAGS, jfs_mod_SOURCES, jfs_mod_CFLAGS)
(iso9660_mod_SOURCES, iso9660_mod_CFLAGS, _linux_mod_SOURCES)
(_linux_mod_CFLAGS, linux_mod_SOURCES, linux_mod_CFLAGS)
(normal_mod_SOURCES, normal_mod_CFLAGS, normal_mod_ASFLAGS)
(hello_mod_SOURCES, hello_mod_CFLAGS, boot_mod_SOURCES)
(boot_mod_CFLAGS, terminal_mod_SOURCES, terminal_mod_CFLAGS)
(ls_mod_SOURCES, ls_mod_CFLAGS, cmp_mod_SOURCES, cmp_mod_CFLAGS)
(cat_mod_SOURCES, cat_mod_CFLAGS, font_mod_SOURCES)
(font_mod_CFLAGS, amiga_mod_SOURCES, amiga_mod_CFLAGS)
(apple_mod_SOURCES, apple_mod_CFLAGS, pc_mod_SOURCES)
(pc_mod_CFLAGS): New variables.
* disk/powerpc/ieee1275/ofdisk.c: Include <grub/machine/init.h>.
(grub_ofdisk_iterate): Add a prototype for `dev_iterate'.
* include/grub/dl.h (grub_arch_dl_sync_caches): New prototype.
* include/grub/loader.h (grub_os_area_addr, grub_os_area_size):
Moved from here...
* include/grub/i386/pc/init.h (grub_os_area_addr)
(rub_os_area_size): ... to here.
* include/grub/powerpc/ieee1275/ieee1275.h
(grub_ieee1275_entry_fn): Export symbol.
* include/grub/powerpc/ieee1275/init.h: New file.
* include/grub/powerpc/libgcc.h: Likewise.
* include/grub/cache.h: Likewise.
* kern/powerpc/cache.S: Likewise. Written by Hollis Blanchard
<hollis@penguinppc.org>.
* kern/dl.c: Include <grub/cache.h>.
(grub_dl_flush_cache): New function.
(grub_dl_load_core): Call `grub_dl_flush_cache' to flush the cache
for this module.
* kern/powerpc/ieee1275/init.c (grub_ofdisk_init)
(grub_console_init): Removed prototypes.
(grub_machine_init): Don't initialize the modules anymore.
* kern/powerpc/ieee1275/openfw.c (grub_map): Make the function
static.
* include/grub/powerpc/types.h (GRUB_HOST_WORDS_LITTLEENDIAN):
Macro undef removed.
(GRUB_HOST_WORDS_BIGENDIAN): New macro.
* kern/powerpc/dl.c (grub_arch_dl_relocate_symbols): Add
relocation `R_PPC_REL32'. Return an error when the relocation is
unknown.
* Makefile.in (DATA): Add `$(pkgdata_PROGRAMS)'.
* kern/i386/pc/init.c (grub_arch_sync_caches): New function.
* util/misc.c (grub_arch_sync_caches): Likewise.
2004-12-27 13:46:20 +00:00
|
|
|
elsif program = programs.detect() {|u| u.name.to_var == prefix}
|
|
|
|
print program.rule(args.split(/\s+/))
|
2005-07-24 18:16:26 +00:00
|
|
|
elsif script = scripts.detect() {|s| s.name.to_var == prefix}
|
|
|
|
print script.rule(args.split(/\s+/))
|
2002-12-27 08:53:07 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|