[cairo] Patch for enabling debug or release versions in Cairo's Windows makefiles
Antoine Azar
cairo at antoineazar.com
Sat Jan 19 16:25:06 PST 2008
Hey all,
I modified the windows makefiles to support debug or release
configurations. I was tired of juggling between both when debugging
or benchmarking. Just append CFG=debug or CFG=release to your make
command to choose which one you want to build. It'll create and use
debug and release folders respectively. I enabled the change for
pixman and cairo. This is Cairo's patch. Pixman's patch follows.
Antoine
From 7b4395f55b57f4b1935ecb61050bbb96dca8f48a Mon Sep 17 00:00:00 2001
From: Azar at atolaptop.(none) <Azar at atolaptop.(none)>
Date: Fri, 18 Jan 2008 18:19:17 -0500
Subject: [PATCH] Modified all win32 makefiles to support debug or
release configurations. This is enabled by appending the
CFG=debug|release flag to the make command. Debug contains no
optimizations and adds debug information.
---
Makefile.win32 | 30 ++++++-
boilerplate/Makefile.win32 | 22 ++++-
perf/Makefile.win32 | 24 +++++-
src/Makefile.win32 | 31 ++++++--
test/Makefile.win32 | 188 +++++++++++++++++++++++--------------------
5 files changed, 187 insertions(+), 108 deletions(-)
diff --git a/Makefile.win32 b/Makefile.win32
index 8519b89..aad6484 100644
--- a/Makefile.win32
+++ b/Makefile.win32
@@ -4,14 +4,19 @@
CC := cl
LINK := link
+
+ifeq ($(CFG),debug)
+OPT := -Od -Zi
+else
OPT := -O2
+endif
PIXMAN_CFLAGS := -I../../pixman/pixman
-PIXMAN_LIBS := ../../pixman/pixman/pixman-1.lib
+PIXMAN_LIBS := ../../pixman/pixman/$(CFG)/pixman-1.lib
EXE_LDFLAGS = libpng.lib zlib.lib gdi32.lib msimg32.lib user32.lib
-DEFAULT_CFLAGS = -MD -Zi -nologo $(OPT)
+DEFAULT_CFLAGS = -MD -nologo $(OPT)
DEFAULT_CFLAGS += -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE
DEFAULT_CFLAGS += -DPACKAGE_VERSION="" -DPACKAGE_BUGREPORT="" -DCAIRO_BUILD
DEFAULT_CFLAGS += -I.
@@ -34,7 +39,7 @@ SUBDIRS = src
TEST_SUBDIRS = boilerplate test
-all: cairo
+all: inform cairo
cairo: src/cairo-features.h
@list='$(SUBDIRS)'; for f in $$list ; do \
@@ -52,13 +57,28 @@ test: cairo
html:
@(cd test ; make -f Makefile.win32 html)
+inform:
+ifneq ($(CFG),release)
+ifneq ($(CFG),debug)
+ @echo "Invalid configuration "$(CFG)" specified."
+ @echo -n "You must specify a configuration when "
+ @echo "running make, e.g. make CFG=debug"
+ @echo
+ @echo -n "Possible choices for configuration are "
+ @echo "'release' and 'debug'"
+ @exit 1
+endif
+endif
+
endif
# Some generic rules
-%.obj: %.c
+$(CFG)/%.obj: %.c
+ @mkdir -p $(CFG)
@$(CC) $(CFLAGS) -c -Fo"$@" $<
-%-static.obj: %.c
+$(CFG)/%-static.obj: %.c
+ @mkdir -p $(CFG)
@$(CC) $(CFLAGS) -c -DCAIRO_WIN32_STATIC_BUILD=1 -Fo"$@" $<
diff --git a/boilerplate/Makefile.win32 b/boilerplate/Makefile.win32
index 8a45208..4db259b 100644
--- a/boilerplate/Makefile.win32
+++ b/boilerplate/Makefile.win32
@@ -16,12 +16,26 @@ SOURCES = \
xmalloc.c \
$(NULL)
-OBJECTS = $(subst .c,.obj,$(SOURCES))
+OBJECTS = $(patsubst %.c, $(CFG)/%.obj, $(SOURCES))
-all: boiler.lib
-boiler.lib: $(OBJECTS)
+all: $(CFG)/boiler.lib
+
+$(CFG)/boiler.lib: $(OBJECTS)
lib -NOLOGO -OUT:$@ $(OBJECTS) $(WIN_LIBS)
clean:
- @rm -f *.obj *.dll *.lib *.pdb *.ilk || exit 0
\ No newline at end of file
+ @rm -f $(CFG)/*.obj $(CFG)/*.dll $(CFG)/*.lib $(CFG)/*.pdb
$(CFG)/*.ilk || exit 0
+
+inform:
+ifneq ($(CFG),release)
+ifneq ($(CFG),debug)
+ @echo "Invalid configuration "$(CFG)" specified."
+ @echo -n "You must specify a configuration when "
+ @echo "running make, e.g. make CFG=debug"
+ @echo
+ @echo -n "Possible choices for configuration are "
+ @echo "'release' and 'debug'"
+ @exit 1
+endif
+endif
\ No newline at end of file
diff --git a/perf/Makefile.win32 b/perf/Makefile.win32
index 3346540..471f80a 100644
--- a/perf/Makefile.win32
+++ b/perf/Makefile.win32
@@ -7,7 +7,7 @@ SUBMAKEFILE = 1
include ../Makefile.win32
-LDFLAGS += ../src/cairo-static.lib $(PIXMAN_LIBS)
../boilerplate/boiler.lib $(EXE_LDFLAGS)
+LDFLAGS += ../src/$(CFG)/cairo-static.lib $(PIXMAN_LIBS)
../boilerplate/$(CFG)/boiler.lib $(EXE_LDFLAGS)
PERF_SOURCES = \
box-outline.c \
@@ -15,6 +15,7 @@ PERF_SOURCES = \
cairo-perf-cover.c \
cairo-perf.c \
cairo-stats.c \
+ extend-pad.c \
fill.c \
long-dashed-lines.c \
long-lines.c \
@@ -33,11 +34,26 @@ PERF_SOURCES = \
getopt-Win32.c \
$(NULL)
-all: cairo-perf.exe
+OBJECTS = $(patsubst %.c, $(CFG)/%.obj, $(PERF_SOURCES))
-cairo-perf.exe: $(PERF_SOURCES)
+all: inform $(CFG)/cairo-perf.exe
+
+$(CFG)/cairo-perf.exe: $(OBJECTS)
@$(CC) $(CFLAGS) -Fe"$@" $^ -link $(LDFLAGS)
clean:
- @rm -f *.obj *.dll *.lib *.pdb *.ilk || exit 0
+ @rm -f $(CFG)/*.obj $(CFG)/*.exe $(CFG)/*.dll $(CFG)/*.lib
$(CFG)/*.pdb $(CFG)/*.ilk || exit 0
+
+inform:
+ifneq ($(CFG),release)
+ifneq ($(CFG),debug)
+ @echo "Invalid configuration "$(CFG)" specified."
+ @echo -n "You must specify a configuration when "
+ @echo "running make, e.g. make CFG=debug"
+ @echo
+ @echo -n "Possible choices for configuration are "
+ @echo "'release' and 'debug'"
+ @exit 1
+endif
+endif
\ No newline at end of file
diff --git a/src/Makefile.win32 b/src/Makefile.win32
index 179b39c..1c84f74 100644
--- a/src/Makefile.win32
+++ b/src/Makefile.win32
@@ -80,11 +80,13 @@ cairo_headers = \
cairo-svg-test.h \
$(NULL)
-OBJECTS = $(subst .c,.obj,$(SOURCES))
-SHARED_OBJECTS = $(subst .c,.obj,$(STATIC_SOURCES))
-STATIC_OBJECTS = $(subst .c,-static.obj,$(STATIC_SOURCES))
+OBJECTS = $(patsubst %.c, $(CFG)/%.obj, $(SOURCES))
+SHARED_OBJECTS = $(patsubst %.c, $(CFG)/%.obj, $(STATIC_SOURCES))
+STATIC_OBJECTS = $(patsubst %.c, $(CFG)/%-static.obj, $(STATIC_SOURCES))
-all: cairo.dll cairo-static.lib
+all: inform $(CFG)/cairo.dll $(CFG)/cairo-static.lib
+static: inform $(CFG)/cairo-static.lib
+dynamic: inform $(CFG)/cairo.dll
$(DEFFILE):
(echo EXPORTS; \
@@ -98,11 +100,24 @@ $(DEFFILE):
) >$@
@ ! grep -q cairo_ERROR $@ || ($(RM) $@; false)
-cairo.dll: $(OBJECTS) $(SHARED_OBJECTS) $(DEFFILE)
- $(CC) -MD -Zi -LD -Fe$@ $(PIXMAN_LIBS) $(OBJECTS) $(SHARED_OBJECTS)
-link -DEF:$(DEFFILE) user32.lib gdi32.lib libpng.lib zdll.lib msimg32.lib
+$(CFG)/cairo.dll: $(OBJECTS) $(SHARED_OBJECTS) $(DEFFILE)
+ $(CC) -MD -LD -Fe$@ $(PIXMAN_LIBS) $(OBJECTS) $(SHARED_OBJECTS)
-link -DEF:$(DEFFILE) user32.lib gdi32.lib libpng.lib zdll.lib msimg32.lib
-cairo-static.lib: $(OBJECTS) $(STATIC_OBJECTS)
+$(CFG)/cairo-static.lib: $(OBJECTS) $(STATIC_OBJECTS)
lib -NOLOGO -OUT:$@ $(PIXMAN_LIBS) $(OBJECTS) $(STATIC_OBJECTS)
clean:
- @rm -f *.obj *.dll *.lib *.pdb *.ilk || exit 0
+ @rm -f $(CFG)/*.obj $(CFG)/*.dll $(CFG)/*.lib $(CFG)/*.pdb
$(CFG)/*.ilk || exit 0
+
+inform:
+ifneq ($(CFG),release)
+ifneq ($(CFG),debug)
+ @echo "Invalid configuration "$(CFG)" specified."
+ @echo -n "You must specify a configuration when "
+ @echo "running make, e.g. make CFG=debug"
+ @echo
+ @echo -n "Possible choices for configuration are "
+ @echo "'release' and 'debug'"
+ @exit 1
+endif
+endif
\ No newline at end of file
diff --git a/test/Makefile.win32 b/test/Makefile.win32
index d23ef1a..79c1090 100644
--- a/test/Makefile.win32
+++ b/test/Makefile.win32
@@ -5,94 +5,94 @@ include ../Makefile.win32
CFLAGS += -I../src -I../boilerplate -I./pdiff
-LDFLAGS += ./pdiff/pdiff.lib ../src/cairo-static.lib $(PIXMAN_LIBS)
../boilerplate/boiler.lib $(EXE_LDFLAGS)
+LDFLAGS += ./pdiff/pdiff.lib ../src/$(CFG)/cairo-static.lib
$(PIXMAN_LIBS) ../boilerplate/$(CFG)/boiler.lib $(EXE_LDFLAGS)
TESTS = \
+a8-mask \
+caps-joins \
+caps-joins-alpha \
+caps-sub-paths \
+clip-all \
+clip-fill-rule \
+clip-fill-rule-pixel-aligned \
+clip-nesting \
+clip-operator \
+clip-twice \
+composite-integer-translate-source \
+composite-integer-translate-over \
+composite-integer-translate-over-repeat \
+create-for-stream \
+create-from-png \
+create-from-png-stream \
+dash-caps-joins \
+dash-no-dash \
+dash-offset-negative \
+dash-scale \
+dash-zero-length \
+degenerate-path \
+device-offset \
+device-offset-positive \
extend-pad \
extend-reflect \
-#a8-mask \
-#caps-joins \
-#caps-joins-alpha \
-#caps-sub-paths \
-#clip-all \
-#clip-fill-rule \
-#clip-fill-rule-pixel-aligned \
-#clip-nesting \
-#clip-operator \
-#clip-twice \
-#composite-integer-translate-source \
-#composite-integer-translate-over \
-#composite-integer-translate-over-repeat \
-#create-for-stream \
-#create-from-png \
-#create-from-png-stream \
-#dash-caps-joins \
-#dash-no-dash \
-#dash-offset-negative \
-#dash-scale \
-#dash-zero-length \
-#degenerate-path \
-#device-offset \
-#device-offset-positive \
-#fill-and-stroke \
-#fill-and-stroke-alpha \
-#fill-and-stroke-alpha-add \
-#fill-rule \
-#filter-nearest-offset \
-#font-face-get-type \
-#font-matrix-translation \
-#glyph-cache-pressure \
-#get-and-set \
-#get-clip \
-#get-group-target \
-#get-path-extents \
-#gradient-alpha \
-#leaky-dash \
-#leaky-polygon \
-#line-width \
-#line-width-scale \
-#linear-gradient \
-#mask \
-#mask-ctm \
-#mask-surface-ctm \
-#move-to-show-surface \
-#new-sub-path \
-#nil-surface \
-#operator-clear \
-#operator-source \
-#paint \
-#paint-source-alpha \
-#paint-with-alpha \
-#pattern-get-type \
-#pattern-getters \
-#pixman-rotate \
-#rectangle-rounding-error \
-#scale-source-surface-paint \
-#select-font-face \
-#select-font-no-show-text \
-#self-copy \
-#self-intersecting \
-#set-source \
-#show-text-current-point \
-#source-clip \
-#source-surface-scale-paint \
-#surface-finish-twice \
-#surface-pattern \
-#text-antialias-gray \
-#text-antialias-none \
-#text-antialias-subpixel \
-#text-cache-crash \
-#text-pattern \
-#text-rotate \
-#transforms \
-#translate-show-surface \
-#trap-clip \
-#unantialiased-shapes \
-#unbounded-operator \
-#user-data \
-#rel-path \
-#push-group \
-#zero-alpha \
+fill-and-stroke \
+fill-and-stroke-alpha \
+fill-and-stroke-alpha-add \
+fill-rule \
+filter-nearest-offset \
+font-face-get-type \
+font-matrix-translation \
+glyph-cache-pressure \
+get-and-set \
+get-clip \
+get-group-target \
+get-path-extents \
+gradient-alpha \
+leaky-dash \
+leaky-polygon \
+line-width \
+line-width-scale \
+linear-gradient \
+mask \
+mask-ctm \
+mask-surface-ctm \
+move-to-show-surface \
+new-sub-path \
+nil-surface \
+operator-clear \
+operator-source \
+paint \
+paint-source-alpha \
+paint-with-alpha \
+pattern-get-type \
+pattern-getters \
+pixman-rotate \
+rectangle-rounding-error \
+scale-source-surface-paint \
+select-font-face \
+select-font-no-show-text \
+self-copy \
+self-intersecting \
+set-source \
+show-text-current-point \
+source-clip \
+source-surface-scale-paint \
+surface-finish-twice \
+surface-pattern \
+text-antialias-gray \
+text-antialias-none \
+text-antialias-subpixel \
+text-cache-crash \
+text-pattern \
+text-rotate \
+transforms \
+translate-show-surface \
+trap-clip \
+unantialiased-shapes \
+unbounded-operator \
+user-data \
+rel-path \
+push-group \
+zero-alpha \
$(NULL)
TESTCORE_SOURCES = \
@@ -100,11 +100,12 @@ TESTCORE_SOURCES = \
buffer-diff.c \
$(NULL)
-TEST_EXE = $(addsuffix .exe,$(TESTS))
+TEST_EXE = $(patsubst %, $(CFG)/%.exe, $(TESTS))
+# TEST_EXE = $(addsuffix .exe,$(TESTS))
all: $(TEST_EXE)
-%.exe: %.c ./pdiff/pdiff.lib
+$(CFG)/%.exe: %.c ./pdiff/pdiff.lib
@$(CC) $(CFLAGS) -Fe"$@" $< $(TESTCORE_SOURCES) -link $(LDFLAGS)
./pdiff/pdiff.lib:
@@ -121,4 +122,17 @@ html:
@perl make-html.pl > index.html
clean:
- @rm -f *.obj *.dll *.lib *.pdb *.ilk *.exe || exit 0
+ @rm -f $(CFG)/*.obj $(CFG)/*.dll $(CFG)/*.lib $(CFG)/*.pdb
$(CFG)/*.ilk $(CFG)/*.exe || exit 0
+
+inform:
+ifneq ($(CFG),release)
+ifneq ($(CFG),debug)
+ @echo "Invalid configuration "$(CFG)" specified."
+ @echo -n "You must specify a configuration when "
+ @echo "running make, e.g. make CFG=debug"
+ @echo
+ @echo -n "Possible choices for configuration are "
+ @echo "'release' and 'debug'"
+ @exit 1
+endif
+endif
\ No newline at end of file
--
1.5.4.rc3.941.gebb79
More information about the cairo
mailing list