#############################################################################
#                                  _   _ ____  _     
#  Project                     ___| | | |  _ \| |    
#                             / __| | | | |_) | |    
#                            | (__| |_| |  _ <| |___ 
#                             \___|\___/|_| \_\_____|
#
# Copyright (C) 1998 Daniel Stenberg and Rafael Sagula
# ------------------------------------------------------------
#   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; either version 2, or (at your option)
#   any later version.
#
#   This program is distributed in the hope that it will be useful,
#   but WITHOUT ANY WARRANTY; without even the implied warranty of
#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#   GNU General Public License for more details.
#
#   You should have received a copy of the GNU General Public License
#   along with this program; if not, write to the Free Software
#   Foundation, Inc., 59 Temple Place - Suite 330, Boston,
#   MA 02111-1307, USA
# ------------------------------------------------------------
# Main author:
# - Daniel Stenberg <Daniel.Stenberg@sth.frontec.se>
#
# 	http://www.fts.frontec.se/~dast/curl/
#
# $Source: /home/hardcore/dast/src/curl/RCS/Makefile,v $
# $Revision: 1.9 $
# $Date: 1998/06/06 12:45:58 $
# $Author: dast $
# $State: Exp $
# $Locker: dast $
#
# ------------------------------------------------------------
# $Log: Makefile,v $
# Revision 1.9  1998/06/06 12:45:58  dast
# AIX support
#
# Revision 1.8  1998/05/16 18:05:40  dast
# slightly edited
#
# Revision 1.7  1998/04/14 21:42:08  dast
# Improved
#
# Revision 1.6  1998/04/06 14:35:31  dast
# Updated makefile for different platforms
#
# Revision 1.5  1998/04/06 14:01:56  dast
# added SSL things
#
# Revision 1.4  1998/03/23 15:26:49  dast
# Added dependentness on config.h for both modules
#
# Revision 1.3  1998/03/23 15:22:33  dast
# added -D__USE_FIXED_PROTOTYPES__
#
# Revision 1.2  1998/03/23 10:35:36  dast
# Fixed header
#
# Revision 1.1  1998/03/23 09:52:18  dast
# Initial revision
#
#
OBJS=url.o main.o hugehelp.o netrc.o
TARGET=curl
CC = gcc
CFLAGS = -c -g

OS=other

# Uncomment the 
#SSLFLAGS=-I/usr/local/ssl/include -DUSE_SSLEAY

# In general, Unix has strcasecmp()
CPPFLAGS = -DHAVE_STRCASECMP -DOS=\"$(OS)\"\
           $(SSLFLAGS) $(ADDFLAGS)
# Set the include path to the SSL includes

# These are the libs for Linux and SunOS4
LDFLAGS = 

# These should be added for SSL support:
#LDFLAGS += -L/usr/local/ssl/lib -lssl -lcrypto



all:
	@echo "use 'make <system>' to build."
	@echo " available systems are: aix, solaris, sunos, linux"
	@echo " to build with SSL support, edit the Makefile!"
	@echo " to build for other systems, try 'make $(TARGET)'"

linux:
	make $(TARGET) OS=linux

solaris:
	make $(TARGET) "LDFLAGS=-lnsl -lsocket" ADDFLAGS=-DUSE_SOCKIO OS=solaris

sunos:
	make $(TARGET) LDFLAGS="" "ADDFLAGS=-DINCLUDE_PARAM_H -D__USE_FIXED_PROTOTYPES__ -DUSE_SOCKIO" OS=sunos

aix:
	make $(TARGET) CC=cc OS=aix

.c.o: url.h
	$(CC) $(CPPFLAGS) $(CFLAGS) $*.c

$(TARGET): $(OBJS) Makefile
	$(CC) -o $(TARGET) $(OBJS) $(LDFLAGS)

clean:
	rm -f *.o *~ $(TARGET) hugehelp.c core

tgz:
	@(dir=`pwd`;name=`basename $$dir`;echo Creates $$name.tar.gz; cd .. ; \
	tar -cf $$name.tar `cat $$name/FILES | sed "s:^:$$name/:g"` ; \
	gzip $$name.tar ; chmod a+r $$name.tar.gz ; mv $$name.tar.gz $$name/)

zip:
	@(dir=`pwd`;name=`basename $$dir`;echo Creates $$name.zip; cd .. ; \
	zip $$name.zip `cat $$name/FILES | sed "s:^:$$name/:g"` ; \
	chmod a+r $$name.zip ; mv $$name.zip $$name/)

main.o: main.c url.h config.h
url.o: url.c url.h config.h
hugehelp.o: hugehelp.c

# This generates the hugehelp.c file
hugehelp.c: README mkhelp
	@rm -f hugehelp.c
	sh mkhelp > hugehelp.c
	@chmod a-w hugehelp.c
