create static link lib (thanks to Maximilian)

This commit is contained in:
oxygenic 2013-01-10 14:49:04 +01:00
parent 1d241cca05
commit 152c7d32af
3 changed files with 28 additions and 11 deletions

View File

@ -26,16 +26,24 @@ POSTAL:= postal.c auspost.c imail.c
POSTAL_OBJ:= postal.o auspost.o imail.o POSTAL_OBJ:= postal.o auspost.o imail.o
TWODIM:= code16k.c dmatrix.c pdf417.c qr.c maxicode.c composite.c aztec.c code49.c code1.c gridmtx.c TWODIM:= code16k.c dmatrix.c pdf417.c qr.c maxicode.c composite.c aztec.c code49.c code1.c gridmtx.c
TWODIM_OBJ:= code16k.o dmatrix.o pdf417.o qr.o maxicode.o composite.o aztec.o code49.o code1.o gridmtx.o TWODIM_OBJ:= code16k.o dmatrix.o pdf417.o qr.o maxicode.o composite.o aztec.o code49.o code1.o gridmtx.o
OBJS:=$(COMMON_OBJ) $(ONEDIM_OBJ) $(TWODIM_OBJ) $(POSTAL_OBJ)
LIBS:= -lz -lm -lpng LIBS:= -lz -lm -lpng
all: libzint.a libzint.so
libzint.a: $(OBJS)
$(AR) rcs libzint.a $(OBJS)
libzint: code.c code128.c 2of5.c upcean.c medical.c telepen.c plessey.c postal.c auspost.c imail.c code16k.c dmatrix.c reedsol.c pdf417.c maxicode.c rss.c common.c render.c png.c library.c ps.c qr.c large.c composite.c aztec.c gs1.c svg.c code49.c code1.c gridmtx.c libzint.so.2.4.4: $(OBJS)
$(CC) -Wall -fPIC $(CFLAGS) $(ZINT_VERSION) -c $(ONEDIM) $(CC) $(CFLAGS) $(ZINT_VERSION) -shared -Wl,-soname,libzint.so -o libzint.so.2.4.4 $(INCLUDE) $(OBJS) $(LIBS)
$(CC) -Wall -fPIC $(CFLAGS) $(ZINT_VERSION) -c $(POSTAL)
$(CC) -Wall -fPIC $(CFLAGS) $(ZINT_VERSION) -c $(TWODIM) libzint.so: libzint.so.2.4.4
$(CC) -Wall -fPIC $(CFLAGS) $(ZINT_VERSION) -c $(COMMON) rm -f libzint.so
$(CC) $(CFLAGS) $(ZINT_VERSION) -shared -Wl,-soname,libzint.so -o libzint.so.2.3.2 $(INCLUDE) $(COMMON_OBJ) $(ONEDIM_OBJ) $(TWODIM_OBJ) $(POSTAL_OBJ) $(LIBS)
ln -s libzint.so.* libzint.so ln -s libzint.so.* libzint.so
%.o: %.c
$(CC) -Wall -fPIC $(CFLAGS) $(ZINT_VERSION) -c -o $@ $<
.PHONY: install uninstall clean dist .PHONY: install uninstall clean dist
install: install:

View File

@ -15,14 +15,23 @@ CFLAGS := -g
prefix := /usr prefix := /usr
bindir := $(prefix)/bin bindir := $(prefix)/bin
DESTDIR := DESTDIR :=
LIBS:= -lz -lm -lpng
zint: main.c all: zint zint-static
$(CC) -Wall $(INCLUDE) $(CFLAGS) $(ZINT_VERSION) -I../backend -L../backend main.c -o zint -lzint
main.o: main.c
$(CC) -c -Wall $(INCLUDE) $(CFLAGS) $(ZINT_VERSION) -I../backend main.c -o main.o
zint: main.o
$(CC) -Wall $(INCLUDE) $(CFLAGS) $(ZINT_VERSION) -I../backend -L../backend main.o -o zint -lzint
zint-static: main.c
$(CC) -Wall $(INCLUDE) $(CFLAGS) $(ZINT_VERSION) -I../backend main.o -o zint-static ../backend/libzint.a $(LIBS)
.PHONY: install uninstall clean dist .PHONY: install uninstall clean dist
clean: clean:
rm -f zint *.o *.a *~ *.png *.eps *.svg *.log rm -f zint zint-static *.o *.a *~ *.png *.eps *.svg *.log
install: install:
install -D -p zint $(DESTDIR)$(bindir)/zint install -D -p zint $(DESTDIR)$(bindir)/zint

View File

@ -168,7 +168,7 @@ int escape_char_process(struct zint_symbol *my_symbol, unsigned char input_strin
return error_number; return error_number;
} }
char itoc(int source) static char itoc(int source)
{ /* Converts an integer value to its hexadecimal character */ { /* Converts an integer value to its hexadecimal character */
if ((source >= 0) && (source <= 9)) { if ((source >= 0) && (source <= 9)) {
return ('0' + source); } return ('0' + source); }
@ -176,7 +176,7 @@ char itoc(int source)
return ('A' + (source - 10)); } return ('A' + (source - 10)); }
} }
void concat(char dest[], char source[]) static void concat(char dest[], char source[])
{ /* Concatinates dest[] with the contents of source[], copying /0 as well */ { /* Concatinates dest[] with the contents of source[], copying /0 as well */
unsigned int i, j, n; unsigned int i, j, n;