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

SSSE3_VAR = $(SSSE3)
ifeq ($(SSSE3_VAR),)
SSSE3_VAR=on
endif

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

# 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

# SSSE3 compilation flags
ifeq ($(SSSE3_VAR),on)
PIXMAN_CFLAGS += $(SSSE3_CFLAGS)
libpixman_sources += pixman-ssse3.c
endif

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

# targets
all: inform informMMX informSSE2 informSSSE3 $(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

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


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

.PHONY: all informMMX informSSE2 informSSSE3
