view makefile @ 0:1493bea5ac22 0.1

Initial version of the standalone heirloom-ed
author markus schnalke <meillo@marmaro.de>
date Mon, 05 Sep 2011 16:31:35 +0200
parents
children 4165f1b57d18
line wrap: on
line source

#
# Root directory. Mainly useful for package building; leave empty for
# normal installation.
#
ROOT = 

PREFIX = /usr/local

#
# Location for binaries.
#
BINDIR = $(PREFIX)/bin

#
# Location for manual pages (with man1, man1b ... man8 below).
#
MANDIR = $(PREFIX)/share/man

#
# Compiler and linker flags.
#

#CC = $(HOME)/src/diet gcc
CC = cc

LD = $(CC)
#LDFLAGS = --static
LDFLAGS = 

#
# Flags for the C preprocessor.
# On Linux with glibc or uClibc, add -D_GNU_SOURCE.
# On Solaris, -D__EXTENSIONS__ should be added.
# On HP-UX, -D_INCLUDE__STDC_A1_SOURCE must be added.
# On AIX, -D_TPARM_COMPAT must be added.
# On AIX, -D_MTEXTEND_H should be added if mtextend.h is not found.
# On NetBSD, add -DUSE_TERMCAP.
#
CPPFLAGS = -D_GNU_SOURCE

#
# CFLAGS makes it possible to give special
# compiler flags for objects where speed is critical. There is no other
# purpose with this so setting all to -O will work too.
#
WARN = 
CFLAGS = -O -fomit-frame-pointer $(WARN)


#
# Whether to use the supplied widechar emulation library. This should
# only be enabled if the system lacks appropriate widechar support.
# It is currently needed on
# - Linux/diet libc
# - FreeBSD 4
# - NetBSD 1.x, because it lacks wctype_t/wctrans_t etc. in wctype.h.
# - OpenBSD
#
#IWCHAR = -I../libwchar
#LWCHAR = -L../libwchar -lwchar


#
# Binaries are stripped with this command after installation.
#
STRIP = strip -s -R .comment -R .note

#
# This is the shell used for the compilation phase, the execution of most
# installed scripts, and the shell escapes in the traditional command
# versions. It needs not conform to POSIX. The system shell should work
# fine; for maximum compatibility with traditional tools, the Heirloom
# Bourne shell is recommended. It then must obviously be compiled and
# installed first.
#
SHELL = /bin/sh

#
# Don't change the rest of this file unless you really know what you are
# doing.
#

########################################################################
########################################################################
########################################################################
########################################################################
########################################################################

all: ed

ed: ed.o regexpr.o sigset.o sigrelse.o
	$(LD) $(LDFLAGS) ed.o -o ed

ed.o: ed.c regexp.h
	$(CC) $(CFLAGS) $(CPPFLAGS) $(IWCHAR) -DSHELL='"$(SHELL)"' -I. -c ed.c

regexpr.o: regexpr.c regexpr.h regexp.h
	$(CC) $(CFLAGS) $(CPPFLAGS) $(IWCHAR) -I. -c regexpr.c

sigset.o: sigset.c sigset.h
	$(CC) $(CFLAGS) $(CPPFLAGS) -I. -c sigset.c

sigrelse.o: sigrelse.c sigset.h
	$(CC) $(CFLAGS) $(CPPFLAGS) -I. -c sigrelse.c


install: all
	mkdir -p $(ROOT)$(BINDIR)
	cp ed $(ROOT)$(BINDIR)/ed
	chmod 755 $(ROOT)$(BINDIR)/ed
	$(STRIP) $(ROOT)$(BINDIR)/ed
	mkdir -p $(ROOT)$(MANDIR)/man1
	cp ed.1 $(ROOT)$(MANDIR)/man1/ed.1
	chmod 644 $(ROOT)$(MANDIR)/man1/ed.1

clean:
	rm -f ed.o regexpr.o sigset.o sigrelse.o core log *~

mrproper: clean
	rm -f ed