# /*-----------------------------------------------------------------------*/
# /* WAMCC                               INRIA Rocquencourt - CLoE Project */
# /*                                                           Daniel Diaz */
# /*                                                                       */
# /* Makefile (local compilation)                                          */
# /*-----------------------------------------------------------------------*/

# the following variables are given by ../Makefile at installation time

COMPILER= clp_fd
WGCC    = ../src/fd_gcc


# other local variables

PFLAGS    = -v
CFLAGS    = -O2 -I../src
LFLAGS    =

BIPS    = inline.o read.o write.o format.o dec10io.o const.o term.o \
          misc.o call.o oper.o list.o trace.o \
	  fd_bips.o fd_math.o fd_meta.o b_bips.o
OTHERS  = lib_inline.o

.SUFFIXES:
.SUFFIXES: .o .usr .c .pl $(SUFFIXES)

.pl.c:
	$(COMPILER) $(PFLAGS) -c $*.pl

.pl.usr:
	if [ -f $*.usr ]; then \
	touch $*.usr; \
	else \
	$(COMPILER) $(PFLAGS) -c $*.pl; \
	fi

.usr.o:
	$(WGCC) $(CFLAGS) -c $*.c

.c.o:
	$(WGCC) $(CFLAGS) -c $*.c



all: ../src/builtin.o

../src/builtin.o: build_starter starter.o $(BIPS) $(OTHERS)
	ld -r -o ../src/builtin.o starter.o $(BIPS) $(OTHERS)


starter.c: build_starter Makefile
	build_starter $(BIPS) >starter.c

build_starter: build_starter.c
	$(WGCC) $(CFLAGS) $(LFLAGS) -o build_starter build_starter.c


# bips


inline.o : inline.c inline.usr

read.o   : read.c read.usr

write.o  : write.c write.usr

format.o : format.c format.usr

dec10io.o: dec10io.c dec10io.usr

const.o  : const.c const.usr

term.o   : term.c term.usr

misc.o   : misc.c misc.usr

call.o   : call.c call.usr

oper.o   : oper.c oper.usr

list.o   : list.c list.usr

trace.o  : trace.c trace.usr

fd_bips.o: fd_bips.c fd_bips.usr

fd_math.o: fd_math.c fd_math.usr

fd_meta.o: fd_meta.c fd_meta.usr

b_bips.o : b_bips.c b_bips.usr





# others







# clean

clean:
	-rm *.o build_starter
