--- libjbig/Makefile +++ libjbig/Makefile @@ -1,7 +1,16 @@ # Options for the compiler: A high optimization level is suggested CFLAGS = -O -Wall -ansi -pedantic -all: libjbig.a tstcodec +AR = ar +RANLIB = ranlib + +ifeq ($(USERLAND),Darwin) + SONAME = dylib +else + SONAME = so +endif + +all: libjbig.a libjbig.$(SONAME) tstcodec tstcodec: tstcodec.c jbig.c jbig.h jbig_tab.o $(CC) $(CFLAGS) -o tstcodec -DTEST_CODEC tstcodec.c jbig.c \ @@ -15,8 +26,17 @@ libjbig.a: jbig.o jbig_tab.o rm -f libjbig.a - ar rc libjbig.a jbig.o jbig_tab.o - -ranlib libjbig.a + $(AR) rc libjbig.a jbig.o jbig_tab.o + $(RANLIB) libjbig.a + +SOBJS = jbig.lo jbig_tab.lo +libjbig.so: $(SOBJS) + $(CC) -shared $(LDFLAGS) -o $@ -Wl,-soname -Wl,$@ $(SOBJS) +libjbig.dylib: $(SOBJS) + $(CC) -dynamic $(LDFLAGS) -o $@ -dynamiclib -install_name $@ $(SOBJS) + +%.lo: %.c jbig.h + $(CC) $(CFLAGS) -fPIC -c $< -o $@ jbig.o: jbig.c jbig.h