default: all

top_srcdir = ..
include $(top_srcdir)/pixman/Makefile.sources
include $(top_srcdir)/Makefile.win32.common

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

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

MMX_CFLAGS = -DUSE_X86_MMX -w14710 -w14714
SSE2_CFLAGS = -DUSE_SSE2

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

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

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

# targets
all: inform informMMX informSSE2 $(CFG_VAR)/$(LIBRARY).lib

informMMX:
ifneq ($(MMX),off)
ifneq ($(MMX),on)
ifneq ($(MMX),)
	@echo "Invalid specified MMX option : "$(MMX_VAR)"."
	@echo
	@echo "Possible choices for MMX are 'on' or 'off'"
	@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 "Possible choices for SSE2 are 'on' or 'off'"
	@exit 1
endif
	@echo "Setting SSE2 flag to default value 'on'... (use SSE2=on or SSE2=off)"
endif
endif


# pixman linking
$(CFG_VAR)/$(LIBRARY).lib: $(OBJECTS)
	@$(AR) $(PIXMAN_ARFLAGS) -OUT:$@ $^

.PHONY: all informMMX informSSE2
