# $Id: Smakefile,v 1.7 1993/10/21 04:01:43 ppessi Exp $
# 
# Smakefile for ls, directory lister
#
# Author: ppessi <Pekka.Pessi@hut.fi>
#
# Copyright  1992, 1993 Pekka Pessi
#
# Created      : Mon Nov 30 12:16:32 1992 ppessi
# Last modified: Thu Oct 21 05:57:23 1993 ppessi
#

DEST = amitcp:

ETAGS = etags
INSTALL = copy clone nopro all
RM_F = DELETE FORCE >NIL:
AR_CREATE = tar cf
MKDIR = makedir
BUMPREV= BumpRev

CC = sc

OPTFLAGS= Optimize Stripdebug NoDebug
DEBUGFLAGS= NoOptimize DEBUG=FULLFLUSH

CFLAGS = $(OPTFLAGS)

DEFS=   DEF=NOMYDEBUG DEFINE "RCS_ID_C=static char *rcsid="
IDIRS=  IDIR=Netinclude:
SCFLAGS= Parm=Registers ANSI nostackcheck stringmerge stringsconst \
	nostandardio nomultipleincludes structureequivalence \
	noversion noerrorhighlight onerror=continue ignore=104 ignore=74 \
	startup=cres smallcode smalldata noicons batch \
	map mapsymbols maplib mapxreference \
	optinl optinlocal opttime optcomp=5 optdep=5 optrdep=5 \
	$(IDIRS) $(DEFS) 

LDFLAGS = lib NETLIB:net.lib

PROG   = ls
VERS   = 2
SRCS_H = ls.h
SRCS_C = ls.c user.c list.c sort.c print.c
SRCS   = Smakefile ls.1 $(SRCS_H) $(SRCS_C)
OBJS   = ls.o user.o list.o sort.o print.o 

.c.o:
	@-$(RM_F) $*.o 
	$(CC) $(CFLAGS) $*.c
.c.s:
	$(CC) $(CFLAGS) -S $*.c
.s.o:
	$(CC) $(CFLAGS) -c $*.s

all: SCOPTIONS ls

ls: ls.test
	slink $< to $@ strip noicons
	protect $@ +p

ls.test: $(OBJS)
	$(CC) $(CFLAGS) LINK TO $@ $(OBJS) $(LDFLAGS)

$(PROG).o: 
	-$(BUMPREV) $(VERS) $(PROG)_rev
	-@$(RM_F) $(PROG).o > nil:
	$(CC) $(CFLAGS) $ $(PROG).c

dependecies: $(SRCS_C)
	$(CC) >dependecies $(CFLAGS) -MM $(SRCS_C)

TAGS:
	$(ETAGS) $(SRCS_C) $(SRCS_H)

idents:
	ident $(SRCS)

ls_rev.h:
	echo " " > $@

ls.tar: $(SRCS)
	$(AR_CREATE) $@ $(SRCS)

install: all $(DEST)bin $(DEST)doc
	$(INSTALL) ls $(DEST)bin
	$(INSTALL) ls.1 $(DEST)doc/ls.doc

$(DEST)bin:
	-$(MKDIR) $(DEST)bin

$(DEST)doc:
	-$(MKDIR) $(DEST)doc

SCOPTIONS: Smakefile
	copy to $@ <from < 
$(SCFLAGS) 
<

#
# This should be automatically generated 
#
sort.o : sort.c
ls.o : ls.c ls.h ls_rev.h
list.o : list.c ls.h 
print.o : print.c ls.h
user.o : user.c
