#
#                 ,,,
#                (o o)
#   ####=====oOO--(_)--OOO========================================####
#   ##                                                              ##
#   ##  This file is part of NCD : a directory browser and selector ##
#   ##  Copyright (C) 1995,96 by Olivier Sirol                      ##
#   ##                                                              ##
#   ##  Original Copyright (C) 1995 Borja Etxebarria                ##
#   ##  E-mail : borja@bips.bi.ehu.es                               ##
#   ##                                                              ##
#   ##  File            :  Makefile                                 ##
#   ##  Author          :  Olivier SIROL                            ##
#   ##  Date            :  Nov 1995                                 ##
#   ##                                                              ##
#   ##  E-mail support  :  sirol@ecoledoc.ibp.fr                    ##
#   ##                                                              ##
#   ####==========================================================####
#
#
#   $Id: Makefile,v 1.37 1996/05/16 19:53:01 olivier Exp $
#
#

#
#  This program is free software;  you  can  redistribute  it
#  and/or modify it under the terms of the GNU General Public
#  License as published by the Free Software Foundation.
#
#  This program needs the ncurses library and a TERMINFO database.
#  They are installed whith most Linux distributions.
#  If your OS doesn't ihave these or if you want a recent one
#  you'll have to compile NCURSES (this will also create a 
#  TERMINFO database.). Using a recent one let ncd have good looking
#  box cars, but if you are using Linux or if your system already
#  have a CURSES lib, be aware of using the right .h, .a, and
#  TERMINFO.(see NCURSES install for more help)
#
#  I have build ncurses 1.9.4 on a sparc SUN-OS 4.1, using commands :
#    > ./configure --prefix=/users/dsk03/dea9527/ncurses
#    > make
#    > make install
#  there are bugs whith ncurses 1.9.7a
#
#  The ncurses distribution is available at:
#  ftp://ftp.netcom.com/pub/zm/zmbenhal/ncurses. It is also carried on
#  the GNU distribution site at ftp://prep.ai.mit.edu/pub/gnu.
#



####==============================================================####
##                                                                  ##
##               Choose and modify below for your OS                ##
##                                                                  ##
##                  (Chose one define per block,                    ##
##          first lines of each block are linux defaults)           ##
##                                                                  ##
####==============================================================####


# Whether you have getopt.h (often in /usr/include)
#=====================================================================

GOT_H      = -DHAVE_GETOPT_H
#GOT_H     =

# Path to search in for curses.h
#=====================================================================

INCLUDES  = -I/usr/include/ncurses
#INCLUDES  = -I/users/dsk03/dea9527/ncurses/include/ncurses
#INCLUDES  = -I/home/olivier/ncurses/include/ncurses

# Linker flags to link program whith libncurses.a
#=====================================================================

LIBS      = -lncurses
#LIBS      = -L/users/dsk03/dea9527/ncurses/lib -lncurses
#LIBS      = -L/home/olivier/ncurses/lib -lncurses


# C Compiler flags
#=====================================================================

CFLAGS     = -ansi -D_BSD_SOURCE -D_GNU_SOURCE -O2 $(GOT_H)
#CFLAGS    = -static -O2 $(GOT_H)


####==============================================================####
##                                                                  ##
##                 YOU DON'T NEED TO MODIFY BELOW                   ##
##                                                                  ##
##                (unless you have problems whith                   ##
##                uname, whoami, hostname, or date)                 ##
##                                                                  ##
####==============================================================####

include revision.mk

CC = gcc

MAKE = make 

OBJS = version.o ncd.o glob.o dirs.o nodes.o nodeops.o disp.o curs.o

.c.o: 
	$(CC) $(CFLAGS) $(INCLUDES) -c $<


all : ncd
	@echo "######################################### all done."

ncd : $(OBJS)
	$(CC) $(CFLAGS) -o $@ $(OBJS) $(LIBS)
	strip $@
	chmod 755 $@

getk : getk.o 
	$(CC) $(CFLAGS) -o $@ getk.o $(LIBS)

version.c: dummy
	echo "/* Created by Makefile - Do not modify */" > version.c
	echo "char * NCD_Compiled_by = \"Build on a `uname -mrs`\n\\" >> version.c
	echo "by `whoami`@`hostname` (19`date '+%y/%m/%d'`)\n\";" >> version.c
	echo "char * NCD_Version = \"$(REV_NUMBER)\";" >> version.c
	echo "char * NCD_Date = \"$(REV_DATE)\";" >> version.c

dummy:


distrib:
	$(MAKE) clean
	rm -fr ncd_$(REV_NUMBER)
	mkdir ncd_$(REV_NUMBER)
	-cp * ncd_$(REV_NUMBER)/
	-rm ncd_$(REV_NUMBER)/getrev
	-rm ncd_$(REV_NUMBER)/getlog
	$(MAKE)
	cp ncd ncd_$(REV_NUMBER)/
	tar -cvzf ncd_$(REV_NUMBER).tgz ncd_$(REV_NUMBER)/
	$(MAKE) clean

ci :
	ci RCS/*

ncd.man : ncd.1
	nroff -man ncd.1 > ncd.man
#	gzip -9 ncd.man

#what's the way of creating a .txt from man.1???
ncd.txt : ncd.1
	nroff ncd.1 > ncd.txt


clean :
	rm -f version.c ncd.man ncd.txt *.o *.bak .*.bak core getk ncd #*# *~
	rm -fr ncd_$(REV_NUMBER)




# End of Makefile
