# Makefile for pnmxpad
# Last edited on 2005-01-16 17:22:45 by stolfi

PROG := frb_analyze
   
HFILES := \
  js.h \
  vec.h \
  argparser.h \
  fget.h \
  nget.h \
  filefmt.h \
  r2.h \
  r3.h \
  r4.h \
  r4x4.h \
  rn.h \
  rmxn.h \
  gauss_elim.h \
   \
  frb_types.h \
  frb_proc.h \
  frb_window.h \
  frb_segment.h \
  frb_match.h \
  frb_candidate.h \
  frb_signal.h \
  frb_curve.h \
  frb_geo.h \
  frb_fourier.h \
  \
  frb_analyze.h

CFILES := \
  js.c \
  vec.c \
  argparser.c \
  fget.c \
  nget.c \
  filefmt.c \
  r2.c \
  r3.c \
  r4.c \
  r4x4.c \
  rn.c \
  rmxn.c \
  gauss_elim.c \
   \
  frb_window.c \
  frb_candidate.c \
  frb_signal.c \
  frb_match.c \
  frb_geo.c \
  frb_curve.c \
  frb_segment.c \
  frb_types.c \
  frb_proc.c \
  frb_fourier.c

LIBS :=

SHELL := /bin/sh

MANSECT := 1
MANPAGE := ${PROG}.1

.PHONY: all clean objects

# all: all-lib
# all: clean ${HOFILES} ${OFILES} ${PROG}
all: objects ${PROG}
  
MAINC := ${PROG}.c

HOFILES := ${subst .h,.ho,${HFILES}}
OFILES := ${subst .c,.o,${CFILES}}

objects: ${HOFILES} ${OFILES}

CC := gcc \
  -ansi \
  -Wall  -Wpointer-arith -Wmissing-prototypes

CFLAGS :=   -O -g
LDFLAGS :=       
IFLAGS :=   -I.

DEPFILE := Deps.make

depend:
	/bin/rm -f ${DEPFILE}
	extract-ho-deps ${IFLAGS} -I/usr/include ${HFILES} ${CFILES} \
          | egrep -v ': /usr/include' \
          > ${DEPFILE}
  
.SUFFIXES:

%.o: %.c
	${CC} ${CFLAGS} ${IFLAGS} -c $*.c
  
%.ho: %.h
	${CC} ${CFLAGS} ${IFLAGS} -o $*.ho -c -x c $*.h \
          || /bin/rm -f $*.ho
  
# Special rule for ${PROG}.o:

${PROG}.o: ${MAINC} ${HOFILES}
	${CC} ${CFLAGS} ${IFLAGS} -c ${MAINC}
 
${PROG}: ${OFILES} ${PROG}.o ${LIBS}
	${CC} ${LDFLAGS} -o $@ ${PROG}.o ${OFILES} ${LIBS} -lm

clean:
	-/bin/rm -f *.o *.ho *.a core ${PROG} 

# Include specific dependencies extracted by "make depend"
include ${DEPFILE}