shithub: jbig2

ref: 95609cbc7a973bb5a781d76b00f3649d038be7bd
dir: /Makefile.unix/

View raw version
# Simple unix makefile

default: all

prefix ?= /usr/local

CFLAGS := -Wall -Wextra -Wno-unused-parameter -g -O2

LIB_SRCS := \
	jbig2_arith.c jbig2_arith_int.c jbig2_arith_iaid.c \
	jbig2_huffman.c jbig2_hufftab.c jbig2_segment.c jbig2_page.c \
	jbig2_symbol_dict.c jbig2_text.c jbig2_halftone.c jbig2_generic.c \
	jbig2_refinement.c jbig2_mmr.c jbig2_image.c jbig2.c
LIB_OBJS := $(LIB_SRCS:%.c=%.o)
LIB_HDRS := \
	jbig2.h jbig2_arith.h jbig2_arith_iaid.h jbig2_arith_int.h \
	jbig2_generic.h jbig2_huffman.h jbig2_hufftab.h jbig2_image.h \
	jbig2_mmr.h jbig2_priv.h jbig2_symbol_dict.h jbig2_text.h os_types.h

APP_SRCS := jbig2_image_pbm.c jbig2_image_png.c jbig2dec.c sha1.c
APP_OBJS := $(APP_SRCS:%.c=%.o)
APP_HDRS := sha1.h

$(LIB_OBJS): $(LIB_HDRS)
$(APP_OBJS): $(LIB_HDRS) $(APP_HDRS)

libjbig2dec.a: $(LIB_OBJS)
	ar cru $@ $^

jbig2dec: $(APP_OBJS) libjbig2dec.a
	$(CC) -o $@ $^ -lpng -lz

all: jbig2dec libjbig2dec.a

install: jbig2dec libjbig2dec.a
	install -d $(prefix)/bin $(prefix)/lib $(prefix)/include $(prefix)/man/man1
	install jbig2dec $(prefix)/bin
	install jbig2dec.1 $(prefix)/man/man1
	install jbig2.h $(prefix)/include
	install libjbig2dec.a $(prefix)/lib

clean:
	rm -f *.o jbig2dec libjbig2dec.a