tripl-objs 	= main.o tripl.o error.o klist.o  
tripl-out 	= tripl

MAKEFLAGS 	= --no-print-directory 
CFLAGS 		= -Wall -Werror -Iinclude -g -ldl 

ifeq ($(install-dir),)
	install-dir = /usr/bin
endif


all : 
	@scripts/mkconfig.py 
	@$(MAKE) _real_all

_real_all : $(tripl-objs)
	@$(MAKE) -C arch/ 
	@$(CC) 	$(tripl-objs) -o $(tripl-out) -Larch -larch -ldl 
	@echo "tripl is ready. "

install : $(tripl-out)
	@install $(tripl-out) $(install-dir)

%.o : %.c
	@$(CC) 	-c $*.c $(CFLAGS)
	@echo -e "\tCC\t\t\t$*.c"


.PHONY clean:
	@$(RM) 	-f $(tripl-objs) $(tripl-out)
	@$(MAKE) -C arch/ clean

