#
# This Makefile builds user test suite
# Do not edit this file.
#

include user_tests.mk

MAKE = make
CC = gcc
CFLAGS = -nostdinc -fno-strict-aliasing -fno-builtin -Wall -gstabs+ -Werror
LDFLAGS = -static --entry=_main -Ttext 1000000
LPATH = ../lib
INCLUDES = -I./ -I../inc -I../lib/inc
LIBS = -lthread -lmalloc -lstdio -lstdlib -lstring -lsyscall -lrand

PROGS = $(UPROGS)

.PHONY: all clean

all: ../user_tests.tgz

../user_tests.tgz: $(PROGS) user_tests.mk
	tar -zcvf ../user_tests.tgz $(PROGS) || \
	echo | gzip -c > ../user_tests.tgz

%.o: %.s
	$(CC) -c -o $(*F).o $(CFLAGS) $(INCLUDES) $(*F).s

%.o: %.c
	$(CC) -c -o $(*F).o $(CFLAGS) $(INCLUDES) $(*F).c

$(PROGS): %: %.o crt0.o
	ld $(LDFLAGS) -o $@ crt0.o $< -L$(LPATH) $(LIBS)

clean:
	rm -fr *.o *~ $(PROGS) *.d *.a ../user_tests.tgz
