# @(#) $Id: Makefile,v 1.25 2004/12/05 16:06:47 alex Exp $
# Makefile for EXIFPROBE image file probe

# Any compiler should do
CC=cc
CFLAGS=-DCOLOR

# You probably don't need these
#CFLAGS=-DCOLOR -Wall -Wno-unused -Wno-parentheses -Wno-trigraphs 
#CFLAGS += -DEGETOPT                        # need egetopt.o

#Solaris; cultural differences
#CFLAGS += -Du_int32_t=uint32_t

# You'll NEED this on big-endian machines
#CFLAGS += -DNATIVE_BYTEORDER_BIGENDIAN     # or add to ./byteorder.h

#On Solaris, you may need to use 'gmake', or edit the next line.
PREFIX ?= /usr/local
BINDIR=$(PREFIX)/bin
MANDIR=$(PREFIX)/man/man1

INCLUDES=defs.h extern.h misc.h tifftags.h exiftags.h \
	tiffeptags.h jpegtags.h global.h

MAKERSRCS=maker_nikon.c maker_epson.c maker_olympus.c maker_fujifilm.c \
	maker_casio.c maker_minolta.c maker_sanyo.c maker_canon.c \
    maker_leica.c maker_agfa.c maker_asahi.c maker_panasonic.c

MAKEROBJS=maker_nikon.o maker_epson.o maker_olympus.o maker_fujifilm.o \
	maker_casio.o maker_minolta.o maker_sanyo.o maker_canon.o \
    maker_leica.o maker_agfa.o maker_asahi.o maker_panasonic.o

SRCS=main.c readfile.c print.c tagnames.c process.c misc.c interpret.c \
	print_maker.c maker_generic.c maker_tagnames.c options.c \
	$(MAKERSRCS)

OBJS=main.o readfile.o print.o tagnames.o process.o misc.o interpret.o \
	print_maker.o maker_generic.o maker_tagnames.o options.o veclib.o\
	$(MAKEROBJS)

EGETOPT=
#EGETOPT=egetopt.o

all: byteorder.h exifprobe

byteorder.h:
	sh makebyteorder.sh

veclib.o: lib/veclib.c
	$(CC) -o veclib.o -c $(CFLAGS) lib/veclib.c

# Need the math library to calculate some APEX things...
exifprobe: $(OBJS) $(INCLUDES) $(EGETOPT)
	./mkcomptime > comptime.c
	$(CC) -o exifprobe $(CFLAGS) $(OBJS) $(EGETOPT) comptime.c -lm

install: all
	cp exifprobe $(BINDIR)
	cp exifgrep $(BINDIR)
	cp exifprobe.1 $(MANDIR)
	cp exifgrep.1 $(MANDIR)

rman: exifprobe.1 exifgrep.1
    # edit at <blockquote> & APP0...APPn; rman gets it wrong
	rman -f HTML exifprobe.1 > exifprobe-rman.html
	rman -f HTML exifgrep.1 > exifgrep-rman.html

man: exifprobe.1 exifgrep.1
    # sigh...this gets indents wrong
	groff -man -Tascii exifprobe.1 | rman -f HTML > exifprobe-man.html
	groff -man -Tascii exifgrep.1 | rman -f HTML > exifgrep-man.html

clean:
	rm -f exifprobe *.o comptime.c

distclean: clean
	rm -f byteorder.h MANIFEST.* Makefile.bak exifprobe-*.tar.gz

depend:
	makedepend -- $(CFLAGS) -- $(SRCS)

undepend:
	makedepend

# DO NOT DELETE THIS LINE -- make depend depends on it.
