# LCC_make:
# Sample makefile for Iron Spring PL/I [Linux]
# This makefile will compile a PL/I program
# and link it with libc, using C's malloc and free
# for heap storage management.
# It assumes the compiler has been installed in
# a directory in your $PATH, and that
# the library is in /usr/local/lib.
# It also assumes that gcc is installed on your system.

# The ld flag '-z muldefs' is required to prevent
# link errors caused by possible multiple definitions
# of initialized PL/I EXTERNAL data.

# When linked without libc, the entry point should be
# 'main' or '_pli_Main', defined by the ld option '-e main'.

# 'INC' provides a list of directories to search for include files.
# Each entry should be preceded by '-i'
# 'LIBDIR' is the directory to be searched for the runtlime library.

# The files ${ALTDIR}/fhs.o and ${ALTDIR}/ghs.o are alternate heap    
# storage management procedures that call C's malloc() and free().
# Change 'ALTDIR' to point to your alternate objects.


PLI	= plic
PLIFLGS	= -lixg -ew
INC     = -i.
ALTDIR  = ../lib/alt

%.o:	%.pli 
	${PLI} -C ${PLIFLGS}  $^ -o $*.o
	
%:	%.o
	gcc -o $@ $^ ${ALTDIR}/fhs.o ${ALTDIR}/ghs.o -lprf -Wl,-M -Wl,-zmuldefs >$@.map

