[PATCH] Makefile support for debug and release configurations

unknown (none) AntoineAzar at .
Sat Jan 19 16:23:37 PST 2008


---
 pixman/Makefile.win32 |   37 ++++++++++++++++++++++++++++++++-----
 1 files changed, 32 insertions(+), 5 deletions(-)

diff --git a/pixman/Makefile.win32 b/pixman/Makefile.win32
index e0a1828..510b74c 100644
--- a/pixman/Makefile.win32
+++ b/pixman/Makefile.win32
@@ -3,7 +3,17 @@ LIBRARY = pixman-1
 CC = cl
 LINK = link

-CFLAGS = -MD -Zi -nologo -O2 -D_CRT_SECURE_NO_DEPRECATE
-D_CRT_NONSTDC_NO_DEPRECATE -I../pixman/src -I. -DPACKAGE=$(LIBRARY)
-DPACKAGE_VERSION="" -DPACKAGE_BUGREPORT=""
+ifeq ($(CFG),)
+CFG=release
+endif
+
+CFLAGS = -MD -nologo -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE
-I../pixman/src -I. -DPACKAGE=$(LIBRARY) -DPACKAGE_VERSION=""
-DPACKAGE_BUGREPORT=""
+
+ifeq ($(CFG),debug)
+CFLAGS += -Od -Zi
+else
+CFLAGS += -O2
+endif

 SOURCES = \
 	pixman-region.c		\
@@ -19,13 +29,30 @@ SOURCES = \
 	pixman-timer.c		\
 	$(NULL)

-OBJECTS = $(subst .c,.obj,$(SOURCES))
+OBJECTS = $(patsubst %.c, $(CFG)/%.obj, $(SOURCES))
+
+all: inform $(CFG)/$(LIBRARY).lib

-%.obj: %.c
+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
+
+$(CFG)/%.obj: %.c
+	@mkdir -p $(CFG)
 	@$(CC) -c $(CFLAGS) -Fo"$@" $<

-$(LIBRARY).lib: $(OBJECTS)
+$(CFG)/$(LIBRARY).lib: $(OBJECTS)
 	lib -NOLOGO -OUT:$@ $(OBJECTS)

+
 clean:
-	@rm -f *.obj *.lib *.pdb *.ilk || exit 0
+	@rm -f $(CFG)/*.obj $(CFG)/*.lib $(CFG)/*.pdb $(CFG)/*.ilk || exit 0
--
1.5.4.rc3.941.gebb79




More information about the cairo mailing list