Hello!

When I run

make GRUB_CFLAGS=-g

I expect that the GRUB shell will be built without optimization (because
I'm going to debug it). However, the -O2 option is not suppressed, since
it's hardcoded in stage2/Makefile.in

It is generally a good idea to use $(FOO) instead of @FOO@ in Makefile.am,
since it gives more flexibility at the make time.

Automake is smart enough to place FOO=@FOO@ at the beginning of
Makefile.in when necessary.

Changelog:
        * grub/Makefile.am, stage1/Makefile.am, stage2/Makefile.am:
        Avoid using variables inclosed in '@' because they cannot be
        overridden at the make time

Changelog for the previous patch (sorry, forgot it):
        * stage2/fsys_fat.c (fat_create_blocklist): return 1 for
        the root directory on FAT12 and FAT16

Pavel Roskin
Index: grub/Makefile.am
===================================================================
RCS file: /gd/gnu/anoncvsroot/grub/grub/Makefile.am,v
retrieving revision 1.11
diff -u -r1.11 Makefile.am
--- Makefile.am 1999/08/26 09:42:52     1.11
+++ Makefile.am 1999/08/28 11:07:39
@@ -1,8 +1,8 @@
 sbin_PROGRAMS = grub
 
-AM_CFLAGS = @GRUB_CFLAGS@ -DGRUB_UTIL=1 -DFSYS_EXT2FS=1 -DFSYS_FAT=1 \
+AM_CFLAGS = $(GRUB_CFLAGS) -DGRUB_UTIL=1 -DFSYS_EXT2FS=1 -DFSYS_FAT=1 \
        -DFSYS_FFS=1 -DFSYS_MINIX=1 -fwritable-strings \
        -I$(top_srcdir)/stage2 -I$(top_srcdir)/stage1
 
 grub_SOURCES = main.c asmstub.c getopt.c getopt1.c getopt.h
-grub_LDADD = ../stage2/libgrub.a @GRUB_LIBS@
+grub_LDADD = ../stage2/libgrub.a $(GRUB_LIBS)
Index: stage1/Makefile.am
===================================================================
RCS file: /gd/gnu/anoncvsroot/grub/stage1/Makefile.am,v
retrieving revision 1.7
diff -u -r1.7 Makefile.am
--- Makefile.am 1999/07/13 15:46:20     1.7
+++ Makefile.am 1999/08/28 11:07:39
@@ -3,7 +3,7 @@
 CLEANFILES = $(pkgdata_DATA)
 
 # We can't use builtins or standard includes.
-AM_CFLAGS = @STAGE1_CFLAGS@ -fno-builtin -nostdinc
+AM_CFLAGS = $(STAGE1_CFLAGS) -fno-builtin -nostdinc
 LDFLAGS = -nostdlib -Wl,-N -Wl,-Ttext -Wl,7C00
 
 noinst_PROGRAMS = stage1.exec stage1_lba.exec
Index: stage2/Makefile.am
===================================================================
RCS file: /gd/gnu/anoncvsroot/grub/stage2/Makefile.am,v
retrieving revision 1.10
diff -u -r1.10 Makefile.am
--- Makefile.am 1999/08/26 09:42:55     1.10
+++ Makefile.am 1999/08/28 11:07:40
@@ -16,7 +16,7 @@
 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 fsys_minix.c \
        stage2.c
-libgrub_a_CFLAGS = @GRUB_CFLAGS@ -DGRUB_UTIL=1 -DFSYS_EXT2FS=1 \
+libgrub_a_CFLAGS = $(GRUB_CFLAGS) -DGRUB_UTIL=1 -DFSYS_EXT2FS=1 \
        -DFSYS_FAT=1 -DFSYS_FFS=1 -DFSYS_MINIX=1 -fwritable-strings
 
 # Stage 2 and Stage 1.5's.
@@ -29,7 +29,7 @@
 MOSTLYCLEANFILES = $(noinst_PROGRAMS)
 
 STAGE2_LINK = -nostdlib -Wl,-N -Wl,-Ttext -Wl,8000
-STAGE2_COMPILE = @STAGE2_CFLAGS@ -fno-builtin -nostdinc
+STAGE2_COMPILE = $(STAGE2_CFLAGS) -fno-builtin -nostdinc
 
 STAGE1_5_LINK = -nostdlib -Wl,-N -Wl,-Ttext -Wl,2000
 STAGE1_5_COMPILE = $(STAGE2_COMPILE) -DNO_DECOMPRESSION=1 -DSTAGE1_5=1 \
@@ -40,7 +40,7 @@
 stage2_exec_SOURCES = asm.S boot.c common.c char_io.c cmdline.c \
        disk_io.c gunzip.c stage2.c bios.c smp-imps.c fsys_ext2fs.c \
        fsys_fat.c fsys_ffs.c fsys_minix.c
-stage2_exec_CFLAGS = $(STAGE2_COMPILE) @FSYS_CFLAGS@
+stage2_exec_CFLAGS = $(STAGE2_COMPILE) $(FSYS_CFLAGS)
 stage2_exec_LDFLAGS = $(STAGE2_LINK)
 
 # For e2fs_stage1_5 target.

Reply via email to