.POSIX:

CFLAGS = -O 1
LDFLAGS =
OUTPUT = libfemtokit.a
HEADER = femtokit.h
TESTFILE = hello.c

# Directories for installation. (See Filesystem Hierarchy Standard.)
PREFIX = /usr/local/lib
HPREFIX = /usr/local/include

# All object files are listed here:
OBJS = $(OBJS_PLATDEP)

# Assign the platform-dependent object file set here:
# TODO: assign a default implementation independent of the platform
OBJS_PLATDEP =

# Add platform-dependent object files in separate variables ("OBJS_NAME", e.g.
# OBJS_LINUX) and then, when running the make file, make sure to assign the
# appropriate variable to OBJS_PLATDEP (e.g. OBJS_PLATDEP = $(OBJS_LINUX) ).

all: $(OBJS)
	ar -rs $(OUTNAME) *.o

clean:
	-rm test *.o *.a

install: all
	mv -f $(OUTPUT) $(PREFIX)
	mv -f $(HEADER) $(HPREFIX)

uninstall:
	rm -f $(PREFIX)/$(OUTPUT)
	rm -f $(HPREFIX)/$(HEADER)

test: all
	c99 -l libfemtokit.a -o test test/$(TESTFILE)

.c.o:
	c99 -c $(CFLAGS) $(LDFLAGS) -o $@ $<