summaryrefslogtreecommitdiff
path: root/backend/Makefile.mingw
blob: 87fc946ad38ab7b94d3fefd54f9928232b325339 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
# Linux makefile for libzint
#
# make			compiles with QR Code support
# make install		copies to /usr/lib
# make uninstall	removes library
# make clean		cleans up a previous compilation and any object or editor files
#

ZINT_VERSION:=-DZINT_VERSION=\"2.4.3.0\"


CC:= gcc -m32
LD:= ld
AR:= ar rc
RANLIB:= ranlib
INCLUDE:= -I/mingw/include
CFLAGS:= -O2 -fms-extensions -mms-bitfields -fno-exceptions -fomit-frame-pointer -Wall
LDFLAGS = -Wl,--major-image-version=2 -Wl,--minor-image-version=43
RC:= windres 
RCFLAGS:= -v -F pe-i386 --define GCC_WINDRES

prefix := /mingw
includedir := $(prefix)/include
libdir := $(prefix)/lib
bindir := $(prefix)/bin
DESTDIR :=
APP:=zint
DLL:=$(APP).dll
DLLIMP:=lib$(DLL).a
STATLIB:=lib$(APP).a
TOOLLIB:=lib$(APP).la

COMMON_OBJ:= common.o render.o png.o library.o ps.o large.o reedsol.o gs1.o svg.o
ONEDIM_OBJ:= code.o code128.o 2of5.o upcean.o telepen.o medical.o plessey.o rss.o
POSTAL_OBJ:= postal.o auspost.o imail.o
TWODIM_OBJ:= code16k.o dmatrix.o pdf417.o qr.o maxicode.o composite.o aztec.o code49.o code1.o gridmtx.o

LIB_OBJ:= $(COMMON_OBJ) $(ONEDIM_OBJ) $(TWODIM_OBJ) $(POSTAL_OBJ)
DLL_OBJ:= $(LIB_OBJ:.o=.lo) dllversion.lo

ifeq ($(NO_PNG),true)
DEFINES+= -DNO_PNG
else
DEFINES_DLL+= -DPNG_DLL -DZLIB_DLL
LIBS+= -lpng -lz
endif

LIBS+= -lm

all: $(DLL) $(STATLIB)
DLL: $(DLL)
static: $(STATLIB)

%.lo:%.c
	@echo Compiling $< ...
	$(CC) $(CFLAGS) $(DEFINES) $(DEFINES_DLL) -DDLL_EXPORT -DPIC $(ZINT_VERSION) -c -o $@ $<

%.o:%.c
	@echo Compiling $< ...
	$(CC) $(CFLAGS) $(DEFINES) $(ZINT_VERSION) -c -o $@ $<
	 
libzint.o: libzint.rc
	$(RC) $(RCFLAGS) -o $@ $<
		 
$(DLL):$(DLL_OBJ) libzint.o
	@echo Linking $@...
	$(CC) -shared -Wl,--out-implib,$(DLLIMP) $(LDFLAGS) -o $@ zint.def $(DLL_OBJ) libzint.o $(LIBS)

$(STATLIB): $(LIB_OBJ)
	@echo Linking $@...
	$(AR) $@ $(LIB_OBJ)
	-@ ($(RANLIB) $@ || true) >/dev/null 2>&1
		
.PHONY: install uninstall clean dist

install:
	cp -fp $(DLLIMP) $(DESTDIR)$(libdir)
	cp -fp $(STATLIB) $(DESTDIR)$(libdir)
	cp -fp $(TOOLLIB) $(DESTDIR)$(libdir)
	cp -fp zint.h $(DESTDIR)$(includedir)/zint.h
	cp -fp $(DLL) $(DESTDIR)$(bindir)

uninstall:
	rm $(DESTDIR)$(libdir)/$(DLLIMP)
	rm $(DESTDIR)$(libdir)/$(STATLIB)
	rm $(DESTDIR)$(libdir)/$(TOOLLIB)
	rm $(DESTDIR)$(includedir)/zint.h
	rm $(DESTDIR)$(bindir)/$(DLL)

clean:
	rm -f *.lib *.dll *.o *.a *~ *.res *.exe *.lo *.bak