From a4f95d083b1aa644923d79e7b61df6c2eacca7c2 Mon Sep 17 00:00:00 2001 From: Andrea Canciani Date: Sun, 4 Sep 2011 09:41:41 -0700 Subject: [PATCH] build: Reuse sources and pixman-combine build rules Makefile.am and Makefile.win32 should not duplicate content, as this leads to breaking the build when they are not kept in sync. This can be avoided by listing sources, headers and common build variables/rules in a Makefile.sources file. --- pixman/Makefile.am | 61 +++++++++++-------------------------------------- pixman/Makefile.sources | 55 ++++++++++++++++++++++++++++++++++++++++++++ pixman/Makefile.win32 | 52 ++++++++--------------------------------- 3 files changed, 77 insertions(+), 91 deletions(-) create mode 100644 pixman/Makefile.sources diff --git a/pixman/Makefile.am b/pixman/Makefile.am index 44e6b17..2421a4f 100644 --- a/pixman/Makefile.am +++ b/pixman/Makefile.am @@ -1,60 +1,25 @@ +include $(top_srcdir)/pixman/Makefile.sources + lib_LTLIBRARIES = libpixman-1.la + libpixman_1_la_LDFLAGS = -version-info $(LT_VERSION_INFO) -no-undefined @PTHREAD_LDFLAGS@ libpixman_1_la_LIBADD = @PTHREAD_LIBS@ @DEP_LIBS@ -lm -libpixman_1_la_SOURCES = \ - pixman.h \ - pixman-accessor.h \ - pixman-access.c \ - pixman-access-accessors.c \ - pixman-cpu.c \ - pixman-gradient-walker.c \ - pixman-region16.c \ - pixman-region32.c \ - pixman-compiler.h \ - pixman-private.h \ - pixman-image.c \ - pixman-implementation.c \ - pixman-combine32.c \ - pixman-combine32.h \ - pixman-combine64.c \ - pixman-combine64.h \ - pixman-general.c \ - pixman.c \ - pixman-noop.c \ - pixman-fast-path.c \ - pixman-solid-fill.c \ - pixman-conical-gradient.c \ - pixman-linear-gradient.c \ - pixman-radial-gradient.c \ - pixman-bits-image.c \ - pixman-utils.c \ - pixman-edge.c \ - pixman-edge-accessors.c \ - pixman-edge-imp.h \ - pixman-inlines.h \ - pixman-trap.c \ - pixman-timer.c \ - pixman-matrix.c +libpixman_1_la_SOURCES = $(libpixman_sources) $(libpixman_headers) libpixmanincludedir = $(includedir)/pixman-1 libpixmaninclude_HEADERS = pixman.h pixman-version.h noinst_LTLIBRARIES = -BUILT_SOURCES = pixman-combine32.h pixman-combine32.c pixman-combine64.h pixman-combine64.c - -pixman-combine32.c : pixman-combine.c.template pixman-combine32.h make-combine.pl - $(PERL) $(srcdir)/make-combine.pl 8 < $(srcdir)/pixman-combine.c.template > $@ || ($(RM) $@; exit 1) -pixman-combine32.h : pixman-combine.h.template make-combine.pl - $(PERL) $(srcdir)/make-combine.pl 8 < $(srcdir)/pixman-combine.h.template > $@ || ($(RM) $@; exit 1) - -pixman-combine64.c : pixman-combine.c.template pixman-combine64.h make-combine.pl - $(PERL) $(srcdir)/make-combine.pl 16 < $(srcdir)/pixman-combine.c.template > $@ || ($(RM) $@; exit 1) -pixman-combine64.h : pixman-combine.h.template make-combine.pl - $(PERL) $(srcdir)/make-combine.pl 16 < $(srcdir)/pixman-combine.h.template > $@ || ($(RM) $@; exit 1) +EXTRA_DIST = \ + Makefile.win32 \ + make-combine.pl \ + pixman-combine.c.template \ + pixman-combine.h.template \ + pixman-region.c \ + solaris-hwcap.mapfile \ + $(NULL) -EXTRA_DIST = Makefile.win32 pixman-combine.c.template make-combine.pl pixman-region.c \ - pixman-combine.h.template solaris-hwcap.mapfile -CLEANFILES = pixman-combine32.c pixman-combine64.c pixman-combine32.h pixman-combine64.h +DISTCLEANFILES = $(BUILT_SOURCES) # mmx code if USE_MMX diff --git a/pixman/Makefile.sources b/pixman/Makefile.sources new file mode 100644 index 0000000..ca3f001 --- /dev/null +++ b/pixman/Makefile.sources @@ -0,0 +1,55 @@ +libpixman_sources = \ + pixman.c \ + pixman-access.c \ + pixman-access-accessors.c \ + pixman-bits-image.c \ + pixman-combine32.c \ + pixman-combine64.c \ + pixman-conical-gradient.c \ + pixman-cpu.c \ + pixman-edge.c \ + pixman-edge-accessors.c \ + pixman-fast-path.c \ + pixman-general.c \ + pixman-gradient-walker.c \ + pixman-image.c \ + pixman-implementation.c \ + pixman-linear-gradient.c \ + pixman-matrix.c \ + pixman-noop.c \ + pixman-radial-gradient.c \ + pixman-region16.c \ + pixman-region32.c \ + pixman-solid-fill.c \ + pixman-timer.c \ + pixman-trap.c \ + pixman-utils.c \ + $(NULL) + +libpixman_headers = \ + pixman.h \ + pixman-accessor.h \ + pixman-combine32.h \ + pixman-combine64.h \ + pixman-compiler.h \ + pixman-edge-imp.h \ + pixman-inlines.h \ + pixman-private.h \ + $(NULL) + +BUILT_SOURCES = \ + pixman-combine32.c \ + pixman-combine32.h \ + pixman-combine64.c \ + pixman-combine64.h \ + $(NULL) + +pixman-combine32.c: pixman-combine.c.template make-combine.pl + $(PERL) $(lastword $+) 8 < $< > $@ || ($(RM) $@; exit 1) +pixman-combine32.h: pixman-combine.h.template make-combine.pl + $(PERL) $(lastword $+) 8 < $< > $@ || ($(RM) $@; exit 1) + +pixman-combine64.c: pixman-combine.c.template make-combine.pl + $(PERL) $(lastword $+) 16 < $< > $@ || ($(RM) $@; exit 1) +pixman-combine64.h: pixman-combine.h.template make-combine.pl + $(PERL) $(lastword $+) 16 < $< > $@ || ($(RM) $@; exit 1) diff --git a/pixman/Makefile.win32 b/pixman/Makefile.win32 index 7c92722..d2d018a 100644 --- a/pixman/Makefile.win32 +++ b/pixman/Makefile.win32 @@ -1,7 +1,13 @@ +default: all + +top_srcdir = .. +include $(top_srcdir)/pixman/Makefile.sources + LIBRARY = pixman-1 CC = cl LINK = link +PERL = perl CFG_VAR = $(CFG) ifeq ($(CFG_VAR),) @@ -29,49 +35,19 @@ else CFLAGS += -O2 endif -SOURCES = \ - pixman-image.c \ - pixman-access.c \ - pixman-access-accessors.c \ - pixman-region16.c \ - pixman-region32.c \ - pixman-combine32.c \ - pixman-combine64.c \ - pixman-utils.c \ - pixman-edge.c \ - pixman-edge-accessors.c \ - pixman-trap.c \ - pixman-timer.c \ - pixman-matrix.c \ - pixman-gradient-walker.c \ - pixman-conical-gradient.c \ - pixman-linear-gradient.c \ - pixman-radial-gradient.c \ - pixman-bits-image.c \ - pixman.c \ - pixman-noop.c \ - pixman-cpu.c \ - pixman-fast-path.c \ - pixman-implementation.c \ - pixman-solid-fill.c \ - pixman-general.c \ - $(NULL) - -BUILT_SOURCES = pixman-combine32.h pixman-combine32.c pixman-combine64.h pixman-combine64.c - # MMX compilation flags ifeq ($(MMX_VAR),on) CFLAGS += $(MMX_CFLAGS) -SOURCES += pixman-mmx.c +libpixman_sources += pixman-mmx.c endif # SSE2 compilation flags ifeq ($(SSE2_VAR),on) CFLAGS += $(SSE2_CFLAGS) -SOURCES += pixman-sse2.c +libpixman_sources += pixman-sse2.c endif -OBJECTS = $(patsubst %.c, $(CFG_VAR)/%.obj, $(SOURCES)) +OBJECTS = $(patsubst %.c, $(CFG_VAR)/%.obj, $(libpixman_sources)) # targets all: inform informMMX informSSE2 $(CFG_VAR)/$(LIBRARY).lib @@ -132,16 +108,6 @@ $(CFG_VAR)/%.obj: %.c $(BUILT_SOURCES) $(CFG_VAR)/$(LIBRARY).lib: $(OBJECTS) lib -NOLOGO -OUT:$@ $(OBJECTS) || exit 0 -pixman-combine32.c: pixman-combine.c.template pixman-combine32.h make-combine.pl - perl ./make-combine.pl 8 < $< > $@ || ($(RM) $@; exit 1) -pixman-combine32.h: pixman-combine.h.template make-combine.pl - perl ./make-combine.pl 8 < $< > $@ || ($(RM) $@; exit 1) - -pixman-combine64.c: pixman-combine.c.template pixman-combine64.h make-combine.pl - perl ./make-combine.pl 16 < $< > $@ || ($(RM) $@; exit 1) -pixman-combine64.h: pixman-combine.h.template make-combine.pl - perl ./make-combine.pl 16 < $< > $@ || ($(RM) $@; exit 1) - clean_r: @rm -f $(CFG_VAR)/*.obj $(CFG_VAR)/*.lib $(CFG_VAR)/*.pdb $(CFG)/*.ilk || exit 0 @rm -f $(CFG)/*.obj $(CFG)/*.lib $(CFG)/*.pdb $(CFG)/*.ilk $(BUILT_SOURCES) || exit 0 -- 2.7.4