Hello!
shared_src/bios.c is not mentioned in the makefiles, so it is not included
to the distribution tarball by "make dist"
This defect is cured by basic.diff
What about advanced.diff, it reorganises the build process using brand new
features of automake. You will need the CVS version of automake to
generate Makefile,in's
The idea is to use per-library flags and avoid compilation from one
directory to another.
The "automake hackery" becomes unnecessary (except the line responsible
for "make dist").
This patch has been carefully tested. Its purpose is primarily testing of
automake. However, it is fully suitable for using with GRUB.
advanced.diff implies basic.diff, so you have a choice.
Pavel Roskin
Index: Makefile.am
===================================================================
RCS file: /gd/gnu/anoncvsroot/grub/Makefile.am,v
retrieving revision 1.4
diff -u -r1.4 Makefile.am
--- Makefile.am 1999/06/06 01:40:41 1.4
+++ Makefile.am 1999/06/21 06:30:05
@@ -1,7 +1,7 @@
-SUBDIRS = grub stage1 stage2 \
+SUBDIRS = shared_src stage1 stage2 grub \
e2fs_stage1_5 fat_stage1_5 ffs_stage1_5 \
- docs shared_src debian
-DISTCLEANFILES = ssrcrules.mk
+ docs debian
+
EXTRA_DIST = BUGS
# We get $(PACKAGE) and $(VERSION) from debian/changelog.
Index: configure.in
===================================================================
RCS file: /gd/gnu/anoncvsroot/grub/configure.in,v
retrieving revision 1.8
diff -u -r1.8 configure.in
--- configure.in 1999/06/06 01:40:42 1.8
+++ configure.in 1999/06/21 06:30:05
@@ -32,11 +32,14 @@
#
# Options
#
-sbingrub=
AC_ARG_ENABLE(sbin-grub,
[ --enable-sbin-grub build /sbin/grub command-line utility],
-[test "x$enableval" = xno || sbingrub=grub])
-AC_SUBST(sbingrub)
+[case "${enableval}" in
+ yes) sbingrub=yes ;;
+ no) sbingrub=no ;;
+ *) AC_MSG_ERROR(bad value ${enableval} for --enable-sbin-grub) ;;
+esac],[sbingrub=no])
+AM_CONDITIONAL(SBINGRUB, test x"$sbingrub" = xyes)
#
# Programs
@@ -44,6 +47,7 @@
AC_CHECK_TOOL(CC, gcc)
AC_PROG_CC
+AC_PROG_RANLIB
# Enforce coding standards.
CPPFLAGS="$CPPFLAGS -Wall -Wmissing-prototypes -Wunused"
@@ -70,38 +74,6 @@
[AC_CHECK_LIB(curses, getch, [LIBS="$LIBS -lcurses"
AC_DEFINE(HAVE_LIBCURSES)])])
fi
-
-# Create rules for our shared sources.
-AC_SUBST_FILE(SHARED_SRC_RULES)dnl
-SHARED_SRC_RULES=./ssrcrules.mk
-echo creating $SHARED_SRC_RULES
-rm -f $SHARED_SRC_RULES
-cat > $SHARED_SRC_RULES <<EOF
-# $SHARED_SRC_RULES - Rules for building objects from files in shared_src.
-# Generated automatically by configure.
-asm.o: \$(top_srcdir)/shared_src/asm.S
- @echo '\$(COMPILE) -c \$(top_srcdir)/shared_src/asm.S'; \\
- if test -d .deps; then \\
- \$(COMPILE) -Wp,-MD,.deps/asm.P -c \$(top_srcdir)/shared_src/asm.S; \\
- else \\
- \$(COMPILE) -c \$(top_srcdir)/shared_src/asm.S; \\
- fi
-EOF
-for f in boot common char_io cmdline disk_io gunzip fsys_ffs \
- fsys_ext2fs fsys_fat stage1_5 stage2 bios; do
-
- cat >> $SHARED_SRC_RULES <<EOF
-
-$f.o: \$(top_srcdir)/shared_src/$f.c
- @echo '\$(COMPILE) -c \$(top_srcdir)/shared_src/$f.c'; \\
- if test -d .deps; then \\
- \$(COMPILE) -Wp,-MD,.deps/$f.P -c \$(top_srcdir)/shared_src/$f.c; \\
- else \\
- \$(COMPILE) -c \$(top_srcdir)/shared_src/$f.c; \\
- fi
-
-EOF
-done
AC_OUTPUT([Makefile grub/Makefile stage1/Makefile stage2/Makefile \
e2fs_stage1_5/Makefile fat_stage1_5/Makefile \
Index: e2fs_stage1_5/Makefile.am
===================================================================
RCS file: /gd/gnu/anoncvsroot/grub/e2fs_stage1_5/Makefile.am,v
retrieving revision 1.6
diff -u -r1.6 Makefile.am
--- Makefile.am 1999/06/06 23:30:43 1.6
+++ Makefile.am 1999/06/21 06:30:08
@@ -7,20 +7,11 @@
CLEANFILES = $(pkgdata_DATA) $(pkgdata_DATA)T
noinst_PROGRAMS = e2fs_stage1_5.exec
-# We can't use builtins or standard includes.
-COMPILE = $(CC) -fno-builtin -nostdinc -DFSYS_EXT2FS=1 -DNO_DECOMPRESSION=1 \
- -DSTAGE1_5=1 -DNO_BLOCK_FILES=1 \
- -DCONFIG_FILE_ASM='.string "/boot/grub/stage2"' \
- $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS)
-INCLUDES = -I$(top_srcdir)/shared_src
-
# asm.o absolutely needs to come first!
-e2fs_stage1_5_exec_LDADD = asm.o common.o char_io.o disk_io.o \
- stage1_5.o fsys_ext2fs.o bios.o
+e2fs_stage1_5_exec_LDADD = ../shared_src/libe2fs_a-asm.o \
+ ../shared_src/libe2fs.a
# FIXME: Automake hackery.
-DEP_FILES = .deps/dummy.P $(wildcard .deps/*.P)
-e2fs_stage1_5_exec_SOURCES = dummy.c # needed to drag in C Makefile variables
DISTFILES = $(DIST_COMMON)
e2fs_stage1_5.exec: $(e2fs_stage1_5_exec_LDADD)
@@ -36,5 +27,3 @@
echo "WARNING: stage 1.5 is too big for boot block area ($$size >
$(IMPORTANT_SIZE_LIMIT))."; \
fi
mv -f $@T $@
-
-@SHARED_SRC_RULES@
Index: fat_stage1_5/Makefile.am
===================================================================
RCS file: /gd/gnu/anoncvsroot/grub/fat_stage1_5/Makefile.am,v
retrieving revision 1.6
diff -u -r1.6 Makefile.am
--- Makefile.am 1999/06/06 23:30:44 1.6
+++ Makefile.am 1999/06/21 06:30:09
@@ -7,19 +7,11 @@
CLEANFILES = $(pkgdata_DATA) $(pkgdata_DATA)T
noinst_PROGRAMS = fat_stage1_5.exec
-# We can't use builtins or standard includes.
-COMPILE = $(CC) -fno-builtin -nostdinc -DFSYS_FAT=1 -DNO_DECOMPRESSION=1 \
- -DSTAGE1_5=1 -DCONFIG_FILE_ASM='.string "/boot/grub/stage2"' \
- $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS)
-INCLUDES = -I$(top_srcdir)/shared_src
-
# asm.o absolutely needs to come first!
-fat_stage1_5_exec_LDADD = asm.o common.o char_io.o disk_io.o \
- stage1_5.o fsys_fat.o bios.o
+fat_stage1_5_exec_LDADD = ../shared_src/libfat_a-asm.o \
+ ../shared_src/libfat.a
# FIXME: Automake hackery.
-DEP_FILES = .deps/dummy.P $(wildcard .deps/*.P)
-fat_stage1_5_exec_SOURCES = dummy.c # needed to drag in C Makefile variables
DISTFILES = $(DIST_COMMON)
fat_stage1_5.exec: $(fat_stage1_5_exec_LDADD)
@@ -35,5 +27,3 @@
echo "WARNING: stage 1.5 is too big for boot block area ($$size >
$(IMPORTANT_SIZE_LIMIT))."; \
fi
mv -f $@T $@
-
-@SHARED_SRC_RULES@
Index: ffs_stage1_5/Makefile.am
===================================================================
RCS file: /gd/gnu/anoncvsroot/grub/ffs_stage1_5/Makefile.am,v
retrieving revision 1.6
diff -u -r1.6 Makefile.am
--- Makefile.am 1999/05/12 02:43:08 1.6
+++ Makefile.am 1999/06/21 06:30:09
@@ -5,20 +5,11 @@
CLEANFILES = $(pkgdata_DATA) $(pkgdata_DATA)T
noinst_PROGRAMS = ffs_stage1_5.exec
-# We can't use builtins or standard includes.
-COMPILE = $(CC) -fno-builtin -nostdinc -DFSYS_FFS=1 -DNO_DECOMPRESSION=1 \
- -DSTAGE1_5=1 -DNO_BLOCK_FILES=1 \
- -DCONFIG_FILE_ASM='.string "/boot/grub/stage2"' \
- $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS)
-INCLUDES = -I$(top_srcdir)/shared_src
-
# asm.o absolutely needs to come first!
-ffs_stage1_5_exec_LDADD = asm.o common.o char_io.o disk_io.o \
- stage1_5.o fsys_ffs.o bios.o
+ffs_stage1_5_exec_LDADD = ../shared_src/libffs_a-asm.o \
+ ../shared_src/libffs.a
# FIXME: Automake hackery.
-DEP_FILES = .deps/dummy.c $(wildcard .deps/*.P)
-ffs_stage1_5_exec_SOURCES = dummy.c # needed to drag in C Makefile variables
DISTFILES = $(DIST_COMMON)
ffs_stage1_5.exec: $(ffs_stage1_5_exec_LDADD)
@@ -34,5 +25,3 @@
echo "WARNING: stage 1.5 is too big for boot block area ($$size >
$(IMPORTANT_SIZE_LIMIT))."; \
fi
mv -f $@T $@
-
-@SHARED_SRC_RULES@
Index: grub/Makefile.am
===================================================================
RCS file: /gd/gnu/anoncvsroot/grub/grub/Makefile.am,v
retrieving revision 1.4
diff -u -r1.4 Makefile.am
--- Makefile.am 1999/03/27 22:24:25 1.4
+++ Makefile.am 1999/06/21 06:30:10
@@ -1,15 +1,11 @@
-EXTRA_PROGRAMS = grub
-sbin_PROGRAMS = $(sbingrub)
-CLEANFILES = $(EXTRA_PROGRAMS)
+if SBINGRUB
+sbin_PROGRAMS = grub
+else
+sbin_PROGRAMS =
+endif
-COMPILE = $(CC) -DGRUB_UTIL=1 -fwritable-strings $(DEFS) $(INCLUDES) $(CPPFLAGS)
$(CFLAGS)
-INCLUDES = -I$(top_srcdir)/shared_src
+AM_CFLAGS = -DGRUB_UTIL=1 -fwritable-strings -I$(srcdir)/../shared_src
grub_SOURCES = main.c asmstub.c
-grub_LDADD = boot.o common.o char_io.o cmdline.o disk_io.o gunzip.o \
- fsys_ffs.o fsys_ext2fs.o fsys_fat.o stage2.o
-# FIXME: Automake hackery.
-DEP_FILES = .deps/main.P .deps/asmstub.P $(wildcard .deps/*.P)
-
-@SHARED_SRC_RULES@
+grub_LDADD = ../shared_src/libgrub.a
Index: shared_src/Makefile.am
===================================================================
RCS file: /gd/gnu/anoncvsroot/grub/shared_src/Makefile.am,v
retrieving revision 1.2
diff -u -r1.2 Makefile.am
--- Makefile.am 1999/03/08 06:28:11 1.2
+++ Makefile.am 1999/06/21 06:30:11
@@ -2,6 +2,43 @@
fat.h filesys.h freebsd.h fs.h i386-elf.h imgact_aout.h \
mb_header.h mb_info.h pc_slice.h shared.h smp-imps.h
-EXTRA_DIST = asm.S boot.c char_io.c cmdline.c common.c disk_io.c \
- fsys_ext2fs.c fsys_fat.c fsys_ffs.c gunzip.c smp-imps.c \
- stage1_5.c stage2.c
+EXTRA_DIST = smp-imps.c
+
+if SBINGRUB
+libgrub = libgrub.a
+else
+libgrub =
+endif
+
+noinst_LIBRARIES = libstage2.a libe2fs.a libfat.a libffs.a $(libgrub)
+
+libstage2_a_SOURCES = asm.S boot.c common.c char_io.c cmdline.c disk_io.c \
+ gunzip.c fsys_ffs.c fsys_ext2fs.c fsys_fat.c stage2.c bios.c
+
+libstage2_a_CFLAGS = -fno-builtin -nostdinc
+
+libe2fs_a_SOURCES = asm.S common.c char_io.c disk_io.c \
+ stage1_5.c fsys_ext2fs.c bios.c
+
+libe2fs_a_CFLAGS = -fno-builtin -nostdinc -DFSYS_EXT2FS=1 \
+ -DNO_DECOMPRESSION=1 -DSTAGE1_5=1 -DNO_BLOCK_FILES=1 \
+ -DCONFIG_FILE_ASM='.string "/boot/grub/stage2"'
+
+libfat_a_SOURCES = asm.S common.c char_io.c disk_io.c \
+ stage1_5.c fsys_fat.c bios.c
+
+libfat_a_CFLAGS = -fno-builtin -nostdinc -DFSYS_FAT=1 \
+ -DNO_DECOMPRESSION=1 -DSTAGE1_5=1 \
+ -DCONFIG_FILE_ASM='.string "/boot/grub/stage2"'
+
+libffs_a_SOURCES = asm.S common.c char_io.c disk_io.c \
+ stage1_5.c fsys_ffs.c bios.c
+
+libffs_a_CFLAGS = -fno-builtin -nostdinc -DFSYS_FFS=1 \
+ -DNO_DECOMPRESSION=1 -DSTAGE1_5=1 -DNO_BLOCK_FILES=1 \
+ -DCONFIG_FILE_ASM='.string "/boot/grub/stage2"'
+
+libgrub_a_SOURCES = boot.c common.c char_io.c cmdline.c disk_io.c \
+ gunzip.c fsys_ffs.c fsys_ext2fs.c fsys_fat.c stage2.c
+
+libgrub_a_CFLAGS = -DGRUB_UTIL=1 -fwritable-strings
Index: shared_src/Makefile.am
===================================================================
RCS file: /gd/gnu/anoncvsroot/grub/shared_src/Makefile.am,v
retrieving revision 1.2
diff -u -r1.2 Makefile.am
--- Makefile.am 1999/03/08 06:28:11 1.2
+++ Makefile.am 1999/06/21 06:28:06
@@ -4,4 +4,4 @@
EXTRA_DIST = asm.S boot.c char_io.c cmdline.c common.c disk_io.c \
fsys_ext2fs.c fsys_fat.c fsys_ffs.c gunzip.c smp-imps.c \
- stage1_5.c stage2.c
+ bios.c stage1_5.c stage2.c