# Makefile of ReLaTIve
# Version 1.1

# This Makefile creates a library to link to when compiling a code using ReLaTIve function

ifneq ($(CC),gcc)
CC     = gcc
endif

ifndef rootdir 
rootdir  = ..
endif

ifndef RELdir 
RELdir  = $(rootdir)/SRC
endif

ifndef CFLAGS
CFLAGS 	= -Wall -ansi -pedantic 
endif

ifndef RM
RM     = rm -f
endif

OBJ    = ReLaTIve.o ck_calc.o 
BIN    = librelative.a


all: $(BIN)
	
ck_calc.o: $(RELdir)/ck_calc.c $(RELdir)/ReLaTIve.h 
	@echo "RELIADIFF: compiling ck_calc..."
	@$(CC) $(CFLAGS) -I$(RELdir) -c $(RELdir)/ck_calc.c 
		
ReLaTIve.o: $(RELdir)/ReLaTIve.c $(RELdir)/ck_calc.c $(RELdir)/ReLaTIve.h 
	@echo "ReLaTIve: compiling ReLaTIve..."
	@$(CC) $(CFLAGS) -I$(RELdir) -c $(RELdir)/ReLaTIve.c 


$(BIN): $(OBJ)
	@echo "ReLaTIve: creating library..."
	@ar qc $(BIN) $(OBJ)
	@${RM} $(OBJ) 
	
clean: 
	@echo "ReLaTIve: deleting the built library..."
	@${RM} $(BIN) 



