.PHONY: all dep


GLIB_CFLAGS=$(shell glib-config --cflags)

ifndef CFLAGS
CFLAGS=-g -Wall $(INCLUDES) $(GLIB_CFLAGS)
endif

ifndef PREFIX
PREFIX=/usr/local
endif

INCLUDES=-I../ft/  -I ../freetype/include
LFLAGS=-L../ft/ -L../freetype/ -L/usr/X11R6/lib
CC=gcc

OBJS= ui.o files.o fonts.o main.o print.o format.o commands.o par.o \
	config.o keyboard.o position.o
SVGA_OBJS= io.o
SVGA_LIBS= -lvga
X_OBJS= xio.o
X_LIBS=-lX11

all: timna timna.x

timna: $(OBJS) $(SVGA_OBJS)
	$(CC) $(LFLAGS) -o $@ $^ $(SVGA_LIBS) -lfribidi -lft -lfreetype -lglib

timna.x : $(OBJS) $(X_OBJS)
	$(CC) $(LFLAGS) -o $@ $^ $(X_LIBS) -lfribidi -lft -lfreetype -lglib

clean:
	rm -f *.o timna timna.x *.bak core .depend

install: all
	install timna timna.x $(PREFIX)/bin

dep:
	rm -f .depend
	$(CC) -MM $(INCLUDES) *.c > .depend

ifeq (.depend,$(wildcard .depend))
include .depend
endif

