# Makefile for wfunc		-*- Indented-Text -*-
#
# Copyright (C) 1996, jack
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Library General Public
# License as published by the Free Software Foundation; either
# version 2 of the License, or (at your option) any later version.
#
# This library 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
# Library General Public License for more details.
#
# You should have received a copy of the GNU Library General Public
# License along with this library; if not, write to the Free
# Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

# $Id: Makefile,v 1.1 1996/07/09 10:06:53 jack Exp $

CC	= gcc
DEFS	= 
INCLUDES= -I.
CFLAGS	= -Wall -O2

AS	= as
ASFLAGS	=

LD	= ld
LDFLAGS	= 
LDLIBS	= 

AR	= ar
ARFLAGS	= rv

#---------------------------------------------------------------------#

CDMAKE_SRCS= cdmake.c
CDMAKE_OBJS= $(CDMAKE_SRCS:.c=.o)
VERSION_H= version.h
VERSION_C= version.c
VERSION_O= $(VERSION_C:.c=.o)
SRCS	= $(CDMAKE_SRCS) $(VERSION_C)
OBJS	= $(CDMAKE_OBJS) $(VERSION_O)
HEDS	= version.h

ALLTARGET= $(CDMAKE) $(LIBW)
LIBW=./libw.a
CDMAKE=./cdmake
SUBDIRS = wctype wchar wmisc

#---------------------------------------------------------------------#

.SUFFIXES: .c .o
.c.o:
	$(CC) $(DEFS) $(INCLUDES) $(CFLAGS) $(CPPFLAGS) -c -o $@ $<

.PHONY: all subdir-all
all: subdir-all $(ALLTARGET)
subdir-all: $(CDMAKE)
	-rm -f $(LIBW)
	$(CDMAKE) all $(SUBDIRS)

.PHONY: $(LIBW)
$(LIBW): $(VERSION_O)
	$(AR) $(ARFLAGS) $(LIBW) $^

$(CDMAKE): $(CDMAKE_OBJS)
	$(CC) $(LDFLAGS) -o $@ $^ $(LDLIBS)

.PHONY: clean
clean:
	rm -f *.o *.bak *~ .*~ \#* $(ALLTARGET)

.PHONY: depend
depend:
	echo $(DEFS) $(INCLUDES) $(CFLAGS) $(CPPFLAGS) $(SRCS) > t-file
	/bin/sh mkdep -MM @t-file
	rm t-file

#---------------------------------------------------------------------#
# DO NOT DELETE THIS LINE -- mkdep uses it.
# DO NOT PUT ANYTHING AFTER THIS LINE, IT WILL GO AWAY.

cdmake.o: cdmake.c
version.o: version.c version.h

# IF YOU PUT ANYTHING HERE IT WILL GO AWAY
