# Makefile.  Generated from Makefile.in by configure.
# Makefile for the FB GFX Library. 
# Run 'configure' to generate Makefile from Makefile.in

##################################################################



AR = ar
ARFLAGS = cru
ACLOCAL = @ACLOCAL@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
CC = gcc
CFLAGS = -O2
DEFS = -DHAVE_CONFIG_H
WARN_CFLAGS = @WARN_CFLAGS@ @WARN_PEDANTIC@ @WERROR@
CPP = gcc -E
CPPFLAGS = 
EXEEXT = .exe
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
LDFLAGS = 
LIBICONV = @LIBICONV@
PACKAGE = @PACKAGE@
RANLIB = :
SHELL = /dev/env/DJDIR/bin/sh.exe
ifneq (,)
    VPATH = ../.. ../../ ../../ ../../dos ../../x86
else
    VPATH = ../.. ../../ ../../dos ../../x86
endif

ifeq (,opengl)
VPATH += ../../opengl ../../opengl/ ../../opengl/dos
endif

datadir = ${prefix}/share
exec_prefix = /dev/env/DJDIR
libdir = ${exec_prefix}/lib
localedir = $(datadir)/locale
prefix = /dev/env/DJDIR
srcdir = ../..
top_builddir = .

##################################################################

ifdef DEBUG
    DEFS += -DDEBUG
endif

INCLUDES = -I$(srcdir)
ifneq (,)
    INCLUDES += -I$(srcdir)/
endif
ifneq (,)
    INCLUDES += -I$(srcdir)/
endif
INCLUDES += -I$(srcdir)/dos -I$(srcdir)/x86 -I.

INCLUDES += 

# config.h must be always included before any system header in *nix
INCLUDES += -include config.h


FBRT_LIB = libfbgfx.a
FBRT_OBJDEST = .

ifeq (dos,xbox)
    DEFS += -DENABLE_XBOX -DDISABLE_CDROM
    CFLAGS += -std=gnu99 -ffreestanding -nostdlib -nostdinc -fno-builtin -fno-exceptions -mno-cygwin -march=i386 
    INCLUDES += -I$(OPENXDK)/i386-pc-xbox/include -I$(OPENXDK)/include -I$(OPENXDK)/include/SDL
endif

ALL_CFLAGS = $(CFLAGS) $(CPPFLAGS) $(INCLUDES) # $(WARN_CFLAGS) 

##################################################################

FBRT_OBJS := $(patsubst ../../%.c,$(FBRT_OBJDEST)/%.o,$(wildcard ../../*.c))
FBRT_OBJS += $(patsubst ../../%.s,$(FBRT_OBJDEST)/%.o,$(wildcard ../../*.s))
FBRT_OBJS += $(FBRT_OBJDEST)/libfb_gfx_data.o
FBRT_BASEDEPOBJS := $(patsubst ../..//%.c,$(FBRT_OBJDEST)/%.o,$(wildcard ../..//*.c))
FBRT_BASEDEPOBJS += $(patsubst ../..//%.s,$(FBRT_OBJDEST)/%.o,$(wildcard ../..//*.s))
FBRT_OSDEPOBJS := $(patsubst ../../dos/%.c,$(FBRT_OBJDEST)/%.o,$(wildcard ../../dos/*.c))
FBRT_OSDEPOBJS += $(patsubst ../../dos/%.s,$(FBRT_OBJDEST)/%.o,$(wildcard ../../dos/*.s))
FBRT_CPUDEPOBJS := $(patsubst ../../x86/%.c,$(FBRT_OBJDEST)/%.o,$(wildcard ../../x86/*.c))
FBRT_CPUDEPOBJS += $(patsubst ../../x86/%.s,$(FBRT_OBJDEST)/%.o,$(wildcard ../../x86/*.s))
FBRT_HEADERS := $(wildcard ../../*.h)
FBRT_HEADERS += $(wildcard ../../dos/*.h)

ifeq (,opengl)
    FBRT_OPENGLDEPOBJS := $(patsubst ../../opengl/%.c,$(FBRT_OBJDEST)/%.o,$(wildcard ../../opengl/*.c))
    FBRT_OPENGLDEPOBJS += $(patsubst ../../opengl/%.s,$(FBRT_OBJDEST)/%.o,$(wildcard ../../opengl/*.s))
    FBRT_OPENGLDEPOBJS += $(patsubst ../../opengl//%.c,$(FBRT_OBJDEST)/%.o,$(wildcard ../../opengl//*.c))
    FBRT_OPENGLDEPOBJS += $(patsubst ../../opengl//%.s,$(FBRT_OBJDEST)/%.o,$(wildcard ../../opengl//*.s))
    FBRT_OPENGLDEPOBJS += $(patsubst ../../opengl/dos/%.c,$(FBRT_OBJDEST)/%.o,$(wildcard ../../opengl/dos/*.c))
    FBRT_OPENGLDEPOBJS += $(patsubst ../../opengl/dos/%.s,$(FBRT_OBJDEST)/%.o,$(wildcard ../../opengl/dos/*.s))
endif

FBRT_TOOLSOBJS := $(patsubst ../../tools/%.c,$(FBRT_OBJDEST)/%.o,$(wildcard ../../tools/*.c))
FBRT_TOOLS     := $(patsubst $(FBRT_OBJDEST)/%.o,$(FBRT_OBJDEST)/%$(EXEEXT),$(FBRT_TOOLSOBJS))
FBRT_DATAFILES := $(wildcard ../../data/*.fnt) $(wildcard ../../data/*.pal)

##################################################################

all: $(FBRT_TOOLS) $(FBRT_LIB)

.SUFFIXES:
.SUFFIXES: .c .s .o $(EXEEXT)

$(FBRT_OBJDEST)/%.o : %.c $(FBRT_HEADERS)
	$(COMPILE) $< -o $@

$(FBRT_OBJDEST)/%.o : %.s fb_gfx_mmx.h
	$(CC) $(ALL_CFLAGS) $(DEFS) -x assembler-with-cpp -c $< -o $@

$(FBRT_LIB) : $(FBRT_OBJS) $(FBRT_BASEDEPOBJS) $(FBRT_OSDEPOBJS) $(FBRT_CPUDEPOBJS) $(FBRT_OPENGLDEPOBJS)
	$(AR) $(ARFLAGS) $(FBRT_LIB) $(FBRT_OBJS) $(FBRT_BASEDEPOBJS) $(FBRT_OSDEPOBJS) $(FBRT_CPUDEPOBJS) $(FBRT_OPENGLDEPOBJS)
	$(RANLIB) $(FBRT_LIB)

../../libfb_gfx_data.c: $(FBRT_OBJDEST)/mk_dat$(EXEEXT) ../../data/data.lst $(FBRT_DATAFILES)
	$(FBRT_OBJDEST)/mk_dat$(EXEEXT) -o $@ -I ../../data

$(FBRT_OBJDEST)/mk_dat$(EXEEXT): $(FBRT_OBJDEST)/mk_dat.o $(FBRT_OBJDEST)/libfb_gfx_lzw.o $(FBRT_OBJDEST)/libfb_gfx_lzw_enc.o ../../fb_gfx_lzw.h $(FBRT_OBJDEST)/libfb_gfx_vars.o

$(FBRT_OBJDEST)/%$(EXEEXT): $(FBRT_OBJDEST)/%.o
	$(CC) $(CFLAGS) -o $@ $^

$(FBRT_OBJDEST)/%.o: ../../tools/%.c
	$(COMPILE) -o $@ $<


##################################################################

# Rules to rebuild the configuration

Makefile: $(srcdir)/Makefile.in config.status config.h
	$(SHELL) ./config.status Makefile

config.status: $(srcdir)/configure
	$(SHELL) ./config.status --recheck

$(srcdir)/configure: # $(srcdir)/aclocal.m4
	cd $(srcdir) && $(AUTOCONF)

$(srcdir)/aclocal.m4: # $(srcdir)/../config/acx.m4 \
	$(srcdir)/../config/warnings.m4 \
	$(srcdir)/configure.ac
	cd $(srcdir) && $(ACLOCAL) -I ../config

config.h: stamp-h1
	@test -f config.h || (rm -f stamp-h1 && $(MAKE) stamp-h1)

stamp-h1: $(srcdir)/config.in config.status
	-rm -f stamp-h1
	$(SHELL) ./config.status config.h

$(srcdir)/config.in: # $(srcdir)/configure
	cd $(srcdir) && $(AUTOHEADER)
	-rm -f stamp-h1

# Other miscellaneous targets.

mostlyclean:
	-rm -rf $(FBRT_OBJS) $(FBRT_BASEDEPOBJS) $(FBRT_OSDEPOBJS) $(FBRT_CPUDEPOBJS) $(FBRT_OBJDEST)/mk_dat$(EXEEXT) $(FBRT_OBJDEST)/mk_dat.o $(FBRT_OPENGLDEPOBJS)
	-rm -f $(srcdir)/data/data.dat $(srcdir)/libfb_gfx_data.c

clean: mostlyclean
	-rm -rf makedepend$(EXEEXT) $(FBRT_LIB) $(srcdir)/autom4te.cache

distclean: clean
	-rm -f config.h stamp-h1 config.status config.cache config.log \
	  configure.lineno configure.status.lineno Makefile localedir.h \
	  localedir.hs

maintainer-clean: distclean
	@echo "This command is intended for maintainers to use"
	@echo "it deletes files that may require special tools to rebuild."
	-rm -f $(srcdir)/configure $(srcdir)/aclocal.m4

check:
installcheck:
dvi:
html:
info:
install-info:
install-man:

install:
	cp -v libfb*.a ../../../../lib/dos/

.PHONY: installdirs install install-strip mostlyclean clean distclean \
  maintainer-clean check installcheck dvi html info install-info \
  install-man update-po

COMPILE = $(CC) $(DEFS) $(ALL_CFLAGS) -c

# Implicit rules

.c.o:
	$(COMPILE) $<

.NOEXPORT:
