Makefile.win32   [plain text]


LIBRARY     = pixman-1

CC   = cl
LINK = link

CFG_VAR = $(CFG)
ifeq ($(CFG_VAR),)
CFG_VAR=release
endif

MMX_VAR = $(MMX)
ifeq ($(MMX_VAR),)
MMX_VAR=on
endif

SSE2_VAR = $(SSE2)
ifeq ($(SSE2_VAR),)
SSE2_VAR=on
endif

CFLAGS     = -MD -nologo -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE -I../pixman/src -I. -DPACKAGE=$(LIBRARY) -DPACKAGE_VERSION="" -DPACKAGE_BUGREPORT=""
MMX_CFLAGS = -DUSE_MMX -w14710 -w14714
SSE2_CFLAGS = -DUSE_SSE2

# optimization flags
ifeq ($(CFG_VAR),debug)
CFLAGS += -Od -Zi
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-linear-gradient.c	\
	pixman-radial-gradient.c	\
	pixman-bits-image.c		\
	pixman.c			\
	pixman-cpu.c			\
	pixman-fast-path.c		\
	pixman-implementation.c		\
	pixman-solid-fill.c		\
	pixman-general.c		\
	$(NULL)

# MMX compilation flags
ifeq ($(MMX_VAR),on)
CFLAGS += $(MMX_CFLAGS)
SOURCES += pixman-mmx.c
endif

# SSE2 compilation flags
ifeq ($(SSE2_VAR),on)
CFLAGS += $(SSE2_CFLAGS)
SOURCES += pixman-sse2.c
endif

OBJECTS     = $(patsubst %.c, $(CFG_VAR)/%.obj, $(SOURCES))

# targets
all: inform informMMX informSSE2 $(CFG_VAR)/$(LIBRARY).lib
	@exit 0
clean: inform clean_r 
	@exit 0
pixman: inform informMMX informSSE2 $(CFG_VAR)/$(LIBRARY).lib 
	@exit 0

inform:
ifneq ($(CFG),release)
ifneq ($(CFG),debug)
ifneq ($(CFG),)
	@echo "Invalid specified configuration option : "$(CFG)"."
	@echo
	@echo -n "Possible choices for configuration are "
	@echo "'release' and 'debug'"
	@echo ""
	@exit 1
endif
	@echo "Using default RELEASE configuration... (use CFG=release or CFG=debug)"
endif
endif

informMMX:
ifneq ($(MMX),off)
ifneq ($(MMX),on)
ifneq ($(MMX),)
	@echo "Invalid specified MMX option : "$(MMX_VAR)"."
	@echo
	@echo -n "Possible choices for MMX are 'on' or 'off'"
	@echo ""
	@exit 1
endif
	@echo "Setting MMX flag to default value 'on'... (use MMX=on or MMX=off)"
endif
endif

informSSE2:
ifneq ($(SSE2),off)
ifneq ($(SSE2),on)
ifneq ($(SSE2),)
	@echo "Invalid specified SSE option : "$(SSE2)"."
	@echo
	@echo -n "Possible choices for SSE2 are 'on' or 'off'"
	@echo ""
	@exit 1
endif
	@echo "Setting SSE2 flag to default value 'on'... (use SSE2=on or SSE2=off)"
endif
endif

# pixman compilation and linking
$(CFG_VAR)/%.obj: %.c
	@mkdir -p $(CFG_VAR)
	@$(CC) -c $(CFLAGS) -Fo"$@" $<

$(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 pixman-combine32.c pixman-combine64.c pixman-combine64.c pixman-combine64.h || exit 0