[Mesa-dev] [PATCH] r300g: Use automake to generate Makefile

Tom Stellard tstellar at gmail.com
Sun Feb 19 19:39:58 PST 2012


On Sun, Feb 19, 2012 at 10:13:48PM -0500, Matt Turner wrote:
> Hi Tom,
> 
> Very happy to see this. It looks good, and I'm glad that you replaced
> two Makefiles with only a single Makefile.am. A couple of comments
> below.
> 
> On Sun, Feb 19, 2012 at 10:05 PM, Tom Stellard <tstellar at gmail.com> wrote:
> > ---
> >  configure.ac                                       |    1 +
> >  src/gallium/drivers/r300/.gitignore                |    5 ++
> >  src/gallium/drivers/r300/Makefile                  |   25 ---------
> >  src/gallium/drivers/r300/Makefile.am               |   38 ++++++++++++++
> >  src/gallium/drivers/r300/compiler/tests/.gitignore |    1 -
> >  src/gallium/drivers/r300/compiler/tests/Makefile   |   53 --------------------
> >  6 files changed, 44 insertions(+), 79 deletions(-)
> >  create mode 100644 src/gallium/drivers/r300/.gitignore
> >  delete mode 100644 src/gallium/drivers/r300/Makefile
> >  create mode 100644 src/gallium/drivers/r300/Makefile.am
> >  delete mode 100644 src/gallium/drivers/r300/compiler/tests/.gitignore
> >  delete mode 100644 src/gallium/drivers/r300/compiler/tests/Makefile
> >
> > diff --git a/configure.ac b/configure.ac
> > index 846b623..85da4d3 100644
> > --- a/configure.ac
> > +++ b/configure.ac
> > @@ -1871,6 +1871,7 @@ if test "x$with_gallium_drivers" != x; then
> >             gallium_require_llvm "Gallium R300"
> >             GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS r300"
> >             gallium_check_st "radeon/drm" "dri-r300" "xorg-r300" "" "xvmc-r300" "vdpau-r300" "va-r300"
> > +            AC_CONFIG_FILES([src/gallium/drivers/r300/Makefile])
> 
> Just add this to the existing AC_CONFIG_FILES around line 1934.
> 

I put it here so the Makefile would only be generated if the r300 driver
was actually being built.  Is there any advantage to generating all the
Makefiles unconditionally?

> >             ;;
> >         xr600)
> >             PKG_CHECK_MODULES([RADEON], [libdrm_radeon >= $LIBDRM_RADEON_REQUIRED])
> > diff --git a/src/gallium/drivers/r300/.gitignore b/src/gallium/drivers/r300/.gitignore
> > new file mode 100644
> > index 0000000..5e510eb
> > --- /dev/null
> > +++ b/src/gallium/drivers/r300/.gitignore
> > @@ -0,0 +1,5 @@
> > +Makefile
> > +Makefile.in
> > +radeon_compiler_util_tests
> > +.libs/
> > +.deps/
> > diff --git a/src/gallium/drivers/r300/Makefile b/src/gallium/drivers/r300/Makefile
> > deleted file mode 100644
> > index 2af1913..0000000
> > --- a/src/gallium/drivers/r300/Makefile
> > +++ /dev/null
> > @@ -1,25 +0,0 @@
> > -TOP = ../../../..
> > -include $(TOP)/configs/current
> > -
> > -LIBNAME = r300
> > -
> > -# get C_SOURCES
> > -include Makefile.sources
> > -
> > -# needed to build non-libmesagallium.a targets
> > -C_SOURCES += \
> > -       $(TOP)/src/glsl/ralloc.c \
> > -       $(TOP)/src/mesa/program/register_allocate.c
> > -
> > -#This is for libdrm inlude path
> > -CFLAGS+=$(RADEON_CFLAGS)
> > -
> > -LIBRARY_INCLUDES = \
> > -       -I$(TOP)/include \
> > -       -I$(TOP)/src/mesa \
> > -       -I$(TOP)/src/glsl
> > -
> > -include ../../Makefile.template
> > -
> > -test: default
> > -       @$(MAKE) -s -C compiler/tests/
> > diff --git a/src/gallium/drivers/r300/Makefile.am b/src/gallium/drivers/r300/Makefile.am
> > new file mode 100644
> > index 0000000..152ee96
> > --- /dev/null
> > +++ b/src/gallium/drivers/r300/Makefile.am
> > @@ -0,0 +1,38 @@
> > +include Makefile.sources
> > +
> > +noinst_LIBRARIES = libr300.a
> > +noinst_PROGRAMS = radeon_compiler_util_tests
> > +testdir=compiler/tests
> > +
> > +AM_CFLAGS = \
> > +       -I$(top_builddir)/src/gallium/include \
> > +       -I$(top_builddir)/src/gallium/auxiliary \
> > +       -I$(top_builddir)/src/gallium/drivers \
> > +       -I$(top_builddir)/include \
> > +       -I$(top_builddir)/src/mesa \
> > +       -I$(top_builddir)/src/glsl \
> > +       -I$(top_builddir)/src/mapi \
> > +       $(LLVM_CFLAGS) \
> > +       $(RADEON_CFLAGS)
> > +
> > +libr300_a_SOURCES = \
> > +       $(C_SOURCES) \
> > +       $(top_builddir)/src/glsl/ralloc.c \
> > +       $(top_builddir)/src/mesa/program/register_allocate.c
> 
> All these $(top_builddir) should be $(top_srcdir), right?
>
Right, I'll fix that.

-Tom
> > +
> > +test_LDADD = libr300.a
> > +test_SOURCES = \
> > +       $(testdir)/rc_test_helpers.c \
> > +       $(testdir)/unit_test.c
> > +test_CFLAGS = -I$(top_builddir)/src/gallium/drivers/r300/compiler
> > +
> > +radeon_compiler_util_tests_LDADD = $(test_LDADD)
> > +radeon_compiler_util_tests_CFLAGS = $(test_CFLAGS)
> > +radeon_compiler_util_tests_SOURCES = \
> > +       $(test_SOURCES) \
> > +       $(testdir)/radeon_compiler_util_tests.c
> > +
> > +default: libr300.a
> > +
> > +test: $(noinst_PROGRAMS)
> > +       $(foreach test, $^, @./$(test))
> > diff --git a/src/gallium/drivers/r300/compiler/tests/.gitignore b/src/gallium/drivers/r300/compiler/tests/.gitignore
> > deleted file mode 100644
> > index 85672fe..0000000
> > --- a/src/gallium/drivers/r300/compiler/tests/.gitignore
> > +++ /dev/null
> > @@ -1 +0,0 @@
> > -radeon_compiler_util_tests
> > diff --git a/src/gallium/drivers/r300/compiler/tests/Makefile b/src/gallium/drivers/r300/compiler/tests/Makefile
> > deleted file mode 100644
> > index 6eda34a..0000000
> > --- a/src/gallium/drivers/r300/compiler/tests/Makefile
> > +++ /dev/null
> > @@ -1,53 +0,0 @@
> > -TOP = ../../../../../..
> > -include $(TOP)/configs/current
> > -
> > -CFLAGS += -Wall -Werror
> > -
> > -### Basic defines ###
> > -TESTS =        radeon_compiler_util_tests
> > -
> > -TEST_SOURCES := $(TESTS:=.c)
> > -
> > -SHARED_SOURCES =               \
> > -       rc_test_helpers.c       \
> > -       unit_test.c
> > -
> > -C_SOURCES = $(SHARED_SOURCES) $(TEST_SOURCES)
> > -
> > -INCLUDES = \
> > -       -I. \
> > -       -I..
> > -
> > -COMPILER_LIB = ../../libr300.a
> > -
> > -##### TARGETS #####
> > -
> > -default: depend run_tests
> > -
> > -depend: $(C_SOURCES)
> > -       rm -f depend
> > -       touch depend
> > -       $(MKDEP) $(MKDEP_OPTIONS) $(INCLUDES) $^ 2> /dev/null
> > -
> > -# Remove .o and backup files
> > -clean:
> > -       rm -f $(TESTS) depend depend.bak
> > -
> > -$(TESTS): $(TESTS:=.o) $(SHARED_SOURCES:.c=.o) $(COMPILER_LIB)
> > -       $(APP_CC) -o $@ $^
> > -
> > -run_tests: $(TESTS)
> > -       @echo "RUNNING TESTS:"
> > -       @echo ""
> > -       $(foreach test, $^, @./$(test))
> > -
> > -.PHONY: $(COMPILER_LIB)
> > -$(COMPILER_LIB):
> > -       $(MAKE) -C ../..
> > -
> > -##### RULES #####
> > -.c.o:
> > -       $(CC) -c $(INCLUDES) $(CFLAGS) $(LIBRARY_DEFINES) $< -o $@
> > -
> > -
> > -sinclude depend
> > --
> > 1.7.3.4


More information about the mesa-dev mailing list