#
# Makefile to make hello world
# 
# Note that CDL3 comes bundled with a number of man pages.
# See man cdlc(1), cdlrts(3) and cdlfubar(7)
#

# Set CDLC to where you have installed the CDL3 compiler
CDLC = /usr/pkg/bin/cdlc

# Set the flags for the CDL3 compiler
# Note the final slash at its library include path
CDLFLAGS = -L @cdlincludedir@/ -W

# Add the location of the CDL runtime library to the linker path
LDFLAGS = -L /usr/pkg/lib

# Add the required libraries
LDLIBS = -lcdlrts -lm

SRC =	hello.k3
OBJ =	hello.o
PROG =	hello

.SUFFIXES: .k3

all: $(PROG)

clean:
	rm -f $(OBJ) $(PROG)

$(PROG): $(OBJ)
	$(CC) -o $@ $(LDFLAGS) $(OBJ) $(LDLIBS)

#
# Note that the following is an explicit pattern rule for Gnu make.
# On FreeBSD or Solaris machines use gmake instead of make.
# If you do not have Gnu make, use the following rule.
# hello.o: hello.k3
#	$(CDLC) $(CDLFLAGS) $<
#
%.o: %.k3
	$(CDLC) $(CDLFLAGS) $<

hello.o: hello.k3
