# Makefile for LHarc UNIX Archiver Driver
#               Copyright(C) MCMLXXXIX  Yooichi.Tagawa
# V0.01  Alpha Version                          1989.05.28  Y.Tagawa
# V0.02  Alpha Version R2                       1989.05.29  Y.Tagawa
# V0.03  Release #3  Beta Version               1989.07.02  Y.Tagawa
# V0.03b Modified                               1989.07.13  Y.Tagawa
# V1.00  Fixed                                  1989.09.19  Y.Tagawa
#
# for OSK
# V1.08                                         1990.10.09  Sakura Tomozou
# V2.00 + lzhuf4/5                              1990.10.26
#
# LHa for UNIX
# V0.01  Alpha Version                          1991.10.17  Masaru Oki
# V0.02  Alpha Version Rel.2                    1991.11.26  Masaru Oki
# V0.03  Beta Version                           1991.12.03  Masaru Oki
# V0.04  Beta Version  Rel.2                    1992.01.17  Masaru Oki
#-----------------------------------------------------------------------
# CFLAGS macro definitions...
#-----------------------------------------------------------------------
# DIRECTORY ACCESS STUFF
#  The default (no need swtich) is your machine has
#  opendir(),readdir(),closedir() library and 'direct' structure used.
#  If your machine has no opendir (), readdir (), closedir ()
#  and add lhdir.o into OBJS macro (see bellow)
#  If your machine are 'dirent' (not 'direct') structure used,
#       -DSYSV_SYSTEM_DIR
#  Otherwise "Give up!"
#       -DNODIRECTORY
#
#-----------------------------------------------------------------------
# MEMORY ACCESS STUFF
#  Your machine has no BSTRING library (bcmp,bcopy,bzero).
#       -DNOBSTRING
#
#-----------------------------------------------------------------------
# TIME STUFF
#  Your include file '<sys/time.h>' has no 'struct tm',  define this.
#       -DSYSTIME_HAS_NO_TM
#
#-----------------------------------------------------------------------
# FILE I/O STUFF
#  Your machine has no ftruncate system-call, define this.
#       -DNOFTRUNCATE
#-----------------------------------------------------------------------
# STRING STUFF
#  Your machine has no strdup(), define this.
#     -DNOSTRDUP
#-----------------------------------------------------------------------

LHOBJS          = lharc.o lhadd.o lhlist.o lhext.o header.o
HUFOBJS         = append.o crcio.o dhuf.o extract.o huf.o larc.o maketbl.o \
                  maketree.o shuf.o slide.o util.o

# missing library objects.
#       memset.o
LIBRARYOBJS     = memmove.o strucmp.o patmatch.o strdup.o rename.o

OPTIMIZE        = -g # -O -fstrength-reduce -fomit-frame-pointer
SWITCHIES       = -DEUC # -DNO_VOID -DNONSYSTEM_DIR_LIBRARY
OBJS            = $(LHOBJS) $(HUFOBJS) $(LIBRARYOBJS)

CC              = cc
#CC             = gcc -traditional
CFLAGS          = $(OPTIMIZE) $(SWITCHIES)

DISTDIR         = /usr/local/bin

lha     : $(OBJS)
        $(CC) -o $@ $(OBJS)

##        $(LDFLAGS)

lharc.o lhadd.o lhext.o lhlist.o header.o append.o slide.o \
        extract.o : lharc.h

$(HUFOBJS) : slidehuf.h
crcio.o extract.o slide.o : intrface.h

lharc.man : lharc.n
        jnroff -man lharc.n >lharc.man

clean:
        rm -f core lha $(OBJS)

moreclean:
        rm -f core *.o lha.tar lha.tar.Z *~ \#*

install:
        install -s lha $(DISTDIR)/lha
