# Makefile for ln(1) using the emx kit by Eberhard Mattes.
#
# Copyright (C) 1994, 1995 Ralph Schleicher
#
# 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 of
# the License, 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., 675 Mass Ave, Cambridge, MA 02139, USA.


# Where the binaries will be installed.
#
bindir = /usr/local/bin

# Where the templates will be installed.
#
libdir = /usr/local/lib

# The templates we want to have installed.
#
# ln.exec	basic template for executables
# ln.pack	for executing gzip'ed programs
#
templates = ln.exec ln.pack


### No more changes required.

SHELL = /bin/sh

CC = gcc -Zomf -Zcrtdll
CPPFLAGS = -I.. -DUSE_SYMLINK_HEADERS $(DEFS)
CFLAGS = -Wall -O2
LDFLAGS = -s
LIBS = ../st/symlink_import.lib


.SUFFIXES: .c .obj

.c.obj:
	$(CC) $(CPPFLAGS) $(CFLAGS) -c $<

all: ln.exe $(templates)

ln.exe: ln.obj
	$(CC) $(LDFLAGS) -o $@ ln.obj ln.def $(LIBS)

ln.exec: ln.exec.obj
	$(CC) $(LDFLAGS) -o $@.exe $@.obj $@.def
	mv -f $@.exe $@

ln.pack: ln.pack.obj
	$(CC) $(LDFLAGS) -o $@.exe $@.obj $@.def
	mv -f $@.exe $@


install: all
	cp ln.exe $(bindir)/ln.exe
	for t in $(templates); do cp $$t $(libdir)/$$t; done

uninstall:
	-rm -f $(bindir)/ln.exe
	-for t in $(templates); do rm -f $(libdir)/$$t; done


clean:
	-rm -f *.obj *.exe *~
	-for t in $(templates); do rm -f $$t; done
