#
# Written by Solar Designer and placed in the public domain.
# See crypt_blowfish.c for more information.
#

CC = gcc
AS = gcc
LD = gcc
RM = rm -f
CFLAGS = -c -Wall -O2 -fomit-frame-pointer -funroll-loops
ASFLAGS = -c
LDFLAGS = -s

BLOWFISH_OBJS = \
	crypt_blowfish.o x86.o

CRYPT_OBJS = \
	$(BLOWFISH_OBJS) crypt_gensalt.o wrapper.o

TEST_OBJS = \
	$(BLOWFISH_OBJS) crypt_gensalt.o crypt_test.o

all: $(CRYPT_OBJS)

check: crypt_test
	./crypt_test

crypt_test: $(TEST_OBJS)
	$(LD) $(LDFLAGS) $(TEST_OBJS) -o crypt_test

crypt_test.o: wrapper.c
	$(CC) $(CFLAGS) wrapper.c -DTEST -o crypt_test.o

.c.o:
	$(CC) $(CFLAGS) $*.c

.S.o:
	$(AS) $(ASFLAGS) $*.S

clean:
	$(RM) crypt_test *.o core
