# This file is part of the FreeType project.
#
# It builds the library and test programs for amiga using ADE.
#
# You will need GNU make.
#
# Use this file while in the 'test' directory with the following statement:
#
#   make -f arch/amigaos/Makefile.gcc

ARCH = arch/amigaos
FT_MAKEFILE = $(ARCH)/Makefile.gcc

CC = gcc

LIBDIR = ../lib
INCDIRS = -I$(LIBDIR) -I$(LIBDIR)/$(ARCH) -I. -I$(LIBDIR)/extend

CFLAGS = -ansi -Wall -g -noixemul $(INCDIRS)
# CFLAGS = -Wall -noixemul -O2 -Ilib $(INCDIRS)

SRC = arabic.c \
      common.c \
      ftdump.c \
      fterror.c \
      ftlint.c \
      ftmetric.c \
      ftsbit.c \
      ftstring.c \
      ftstrpnm.c \
      ftstrtto.c \
      fttimer.c \
      ftview.c \
      ftzoom.c

GSRC = gmain.c display.c blitter.c $(ARCH)/gw_amiga.c
GOBJ = $(GSRC:.c=.o)


%.o: %.c
	$(CC) $(CFLAGS) -c -o $@ $<

%.exe:
	$(CC) $(CFLAGS) -o $@ @^


EXEFILES = ftdump \
           fterror \
           ftlint \
           ftmetric \
           ftsbit \
           ftstring \
           ftstrpnm \
           ftstrtto \
           fttimer \
           ftview \
           ftzoom

.PHONY: all debug freetype freetype_debug \
        clean distclean do_clean depend


all: freetype $(EXEFILES)

debug: freetype_debug $(EXEFILES)

freetype:
	$(MAKE) -C $(LIBDIR) -f $(FT_MAKEFILE) all

freetype_debug:
	$(MAKE) -C $(LIBDIR) -f $(FT_MAKEFILE) debug

ftzoom: $(GOBJ) ftzoom.o common.o $(LIBDIR)/libttf.a
ftview: $(GOBJ) ftview.o common.o $(LIBDIR)/libttf.a
ftlint: ftlint.o common.o $(LIBDIR)/libttf.a
ftdump: ftdump.o common.o $(LIBDIR)/libttf.a
ftstring: $(GOBJ) ftstring.o common.o $(LIBDIR)/libttf.a
fttimer: $(GOBJ) fttimer.o common.o $(LIBDIR)/libttf.a
ftsbit: ftsbit.o common.o $(LIBDIR)/libttf.a
ftstrpnm: ftstrpnm.o common.o $(LIBDIR)/libttf.a
ftmetric: ftmetric.o common.o $(LIBDIR)/libttf.a
ftstrtto: $(GOBJ) ftstrtto.o common.o arabic.o $(LIBDIR)/libttf.a


clean: do_clean
	$(MAKE) -C $(LIBDIR) -f $(FT_MAKEFILE) clean

distclean: do_clean
	$(MAKE) -C $(LIBDIR) -f $(FT_MAKEFILE) distclean
	-rm dep.end core
	-rm $(EXE)

do_clean:
	-rm *.o
	-rm arch/amigaos/*.o


depend:
	$(MAKE) -C $(LIBDIR) -f $(FT_MAKEFILE) depend
	$(CC) -E -M $(INCDIRS) $(SRC) $(GSRC) > dep.end

ifeq (dep.end,$(wildcard dep.end))
  include dep.end
endif

# end of Makefile.gcc
