########################################
#
# minimalistic makefile for the Frogbit submission to ECRYPT NoE
#

LD_SEARCHDIR=/usr/lib/gcc-lib/i386-redhat-linux/2.96

OBJEXT= o

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

OBJ_LIST=
OBJ_LIST+= ecrypt-sync-ae.$(OBJEXT)
OBJ_LIST+= ecrypt-frogbit.$(OBJEXT)
OBJ_LIST+= ecrypt-frogbit-prng.$(OBJEXT)

#  The Berlekamp-Massey validation of PRNGs require the following line
#  to be un-commented ...
#
###OBJ_LIST+= lfsr.$(OBJEXT) longpoly.$(OBJEXT)
#
# ... plus the following source files, all borrowed from another project:
#	lfsr.cpp longpoly.cpp lfsr.h longpoly.h abcd_cfg_defs.h abcd_cfg_rules.h
#  abcd_config.h abcd_incl.h

########################################
#
# Some program names for commands
#
########################################

CPP=c++
LD=$(LD_SEARCHDIR)/collect2

ifneq "$(COMSPEC)" ""
### DOS environment
SHELLBIN=e:/msys/bin/

else
### LINUX environment
SHELLBIN=

endif

########################################
#
# Compiler and linker flags
#
########################################

########################################
CFLAGS=

#
# General compiler options
#
CFLAGS+= -x c++ -v
#
# Optimization options
#
CFLAGS+= -O2

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

########################################
# target-dependent rules for targets expected in the command line
########################################

.PHONY:	all
all: ecrypt-frogbit

########################################
# target-specific rules
########################################

%.$(OBJEXT): %.c
	$(CPP) -c $(CFLAGS) $< -o $@

%.$(OBJEXT): %.cpp
	$(CPP) -c $(CFLAGS) $< -o $@

ecrypt-frogbit: $(OBJ_LIST)
	$(LD) -M -m elf_i386 -dynamic-linker /lib/ld-linux.so.2 -o $@ \
		-L$(LD_SEARCHDIR) -L$(LD_SEARCHDIR)/../../.. \
		$(LD_SEARCHDIR)/../../../crt1.o \
		$(LD_SEARCHDIR)/../../../crti.o \
		$(LD_SEARCHDIR)/crtbegin.o \
		$(OBJ_LIST) \
		-lstdc++ -lm -lgcc -lc -lgcc \
		$(LD_SEARCHDIR)/crtend.o \
		$(LD_SEARCHDIR)/../../../crtn.o

########################################
# End
########################################

