# S-Lang Makefile for Unix
# 
# If your system does not have stdlib.h, remove '#' before -DNO_STDLIB_H
# below  (e.g., NeXt, sequent,..)
CFLAGS1 = -Dunix -DFLOAT_TYPE     # -DNO_STDLIB_H
CFLAGS = $(CFLAGS1) -DHAS_MEMSET -DHAS_MEMCPY #-DHAS_MEMCMP #-DHAS_MEMCHR

# C compiler.  For SunOS, use the 2nd gcc form

#CC = cc -O
CC = gcc -O2 -Wall
#CC = gcc -O2 -traditional-cpp     # <--- SunOS.
#CC = cc +O3 -Aa -D_HPUX_SOURCE    # <--- HP-UX

# Note also that if you do not have /usr/include/unistd.h or stdlib.h, you
# should add one or more of: `-DNO_STDLIB_H -DNO_UNISTD_H' to the CC line.

RANLIB = ranlib
# If your system doues not have `ranlib', uncomment the next line:
#RANLIB = echo

OBJS = slang.o slparse.o slmath.o slfile.o slstd.o slarray.o slregexp.o \
       slunix.o slmatrix.o slutty.o slkeymap.o slrline.o slerr.o sltoken.o\
       slmemcpy.o slmemcmp.o slmemset.o slmemchr.o slxstrng.o slgetkey.o\
       sldisply.o slsmg.o slsearch.o slcmd.o

EXEC = calc

libslang.a: ${OBJS}
	rm -f libslang.a
	ar cr libslang.a ${OBJS}
	$(RANLIB) libslang.a

calc: calc.o libslang.a
	$(CC) $(CFLAGS) calc.o -L. libslang.a -lm -o $(EXEC)

worm.o: worm.c
	$(CC) -c $(CFLAGS) -DSLANG worm.c

worm: worm.o libslang.a
	$(CC) $(CFLAGS)  worm.o -o worm -L. -lslang -ltermcap -lm

clean:
	/bin/rm -f *.o *.a *~

