
CPPFLAGS = -Imingw -Icharset -I.
CFLAGS = -Imingw -Icharset -I.


DEFS = -DHAVE_CONFIG_H


CC = gcc
CXX = g++
CXXFLAGS = -O2
CCFLAGS = -O2
CXXCOMPILE = $(CXX) $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CXXFLAGS)
CCOMPILE = $(CC) $(DEFS) $(INCLUDES) $(CFLAGS) $(CCFLAGS)
CXXLD = $(CXX)
LDFLAGS = -shared -Wl,--out-implib,libqrencode.a
CXXLINK = $(CXXLD) $(CXXFLAGS) $(LDFLAGS) -o $@

CONFIG_HEADER = config.h
LIBRARIES =  $(lib_LIBRARIES)

libqrencode_a_OBJECTS = qrencode.o \
						 qrinput.o \
						 bitstream.o \
						 qrspec.o \
						 rscode.o \
						 split.o \
						 mask.o \
						 mmask.o \
						 mqrspec.o

LIBS = -lmingwex -lmingw32 -lgcc -lmoldname -lmsvcrt -luser32 -lkernel32

all: libqrencode.dll

libqrencode.dll:$(libqrencode_a_OBJECTS)
	if exist $@ del $@
	$(CXXLINK) $(LDFLAGS) $(libqrencode_a_OBJECTS) $(libqrencode_LDADD) $(LIBS)

libqrencode_s.a: $(libqrencode_a_OBJECTS)
	if exist $@ del $@
	ar cru $@ $(libqrencode_a_OBJECTS)
	ranlib $@

.cc.o:
	$(CXXCOMPILE) -c $< -o $@
.cpp.o:
	$(CXXCOMPILE) -c $< -o $@
.c.o:
	$(CCOMPILE) -c $< -o $@

