Skip to content

Commit

Permalink
Merge pull request #9 from trozamon/make
Browse files Browse the repository at this point in the history
Makefile fixes - Many thanks trozamon!!
  • Loading branch information
andmarti1424 committed Nov 9, 2014
2 parents f895a9b + cecf484 commit 62c9664
Showing 1 changed file with 67 additions and 208 deletions.
275 changes: 67 additions & 208 deletions src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,111 +20,99 @@ NAME=SCIM
# packaging this with an O/S, for example, you'll probably want to change
# this to /usr. Otherwise, /usr/local is probably more appropriate, unless
# you're replacing the vendor-supplied version.
prefix=/usr
PREFIX=/usr

# This is where the install step puts it.
EXDIR=${prefix}/bin
EXDIR=$(PREFIX)/bin

# This is where the man page goes.
MANDIR=${prefix}/man/man1
MANDIR=$(PREFIX)/man/man1
MANEXT=1
MANMODE=644

# This is where the library file (tutorial) goes.
#LIBDIR=/usr/local/share/$(name) # reno
LIBDIR=${prefix}/share/doc/$(name)
LIBRARY=-DLIBDIR=\"${LIBDIR}\"
LIBDIR=$(PREFIX)/share/doc/$(name)
LIBRARY=-DLIBDIR=\"$(LIBDIR)\"

# Set SIMPLE for lex.c if you don't want arrow keys or lex.c blows up
#SIMPLE=-DSIMPLE
SIMPLE=
#SIMPLE := -DSIMPLE

# Set BROKENCURSES if your curses has the nl/nonl bug
# if it does and you don't set BROKENCURSES, the display will
# be staggered across the screen. Also try IDLOKBAD below.
#BROKENCURSES=-DBROKENCURSES
BROKENCURSES=
#BROKENCURSES := -DBROKENCURSES

# Set USELOCALE to enable country-dependent display of decimal points,
# local character recognition in words, and local @date() format.
#USELOCALE=
USELOCALE=-DUSELOCALE
USELOCALE := -DUSELOCALE


# USE COLORS ?
#USECOLORS=
USECOLORS=-DUSECOLORS
USECOLORS := -DUSECOLORS

# Set DOBACKUPS if you would like a backup copy of a source file on a save
#DOBACKUPS=
DOBACKUPS=-DDOBACKUPS
DOBACKUPS := -DDOBACKUPS

# Set SIGVOID if signal routines are type void.
# use: SIGVOID=-DSIGVOID for:
# System 5.3, SunOS 4.X, VMS, BSD4.4 (reno), and ANSI C Compliant systems
# use: SIGVOID= for:
# BSD systems (excluding reno, BSD4.4), and the UNIXPC 'cc'
#SIGVOID=
SIGVOID=-DSIGVOID
SIGVOID := -DSIGVOID

# Set IEEE_MATH if you need setsticky() calls in your signal handlers
#
#IEEE_MATH=-DIEEE_MATH
IEEE_MATH=
#IEEE_MATH := -DIEEE_MATH

# The -ffloat-store compiler option is necessary for compiling interp.c to
# prevent spurious "Still changing after x iterations" errors, intermittent
# problems with the @round function, comparisons failing when they shouldn't,
# and potentially other similar problems due to FPU registers having greater
# precision than doubles in memory. This is known to be necessary for GCC
# on x86 processors/FPUs, and probably others.
FLOAT_STORE=-ffloat-store
FLOAT_STORE := -ffloat-store

# Set RINT=-DRINT if you do not have rint() in math.h
# Set RINT= on/with (they have rint):
# SunOS 4.0.3c compiler
# BSD4.4 (reno)
#RINT=-DRINT
RINT=
#RINT := -DRINT

# If your system supports POSIX.2 regular expressions, REGEX should be
# set to -DREGCOMP. Otherwise, set REGEX to -DREGCMP if you have the
# regcmp/regex regular expression routines (most System V based systems
# do) or to -DRE_COMP if you have the re_comp/re_exec regular expression
# routines (most BSD based systems do). If your system has no support for
# regular expressions, leave REGEX unset.
#REGEX=
#REGEX=-DREGCMP
#REGEX=-DRE_COMP
REGEX=-DREGCOMP
#REGEX := -DREGCMP
#REGEX := -DRE_COMP
REGEX := -DREGCOMP

# This is the name of a pager like "more".
# "pg" may be appropriate for SYSV.
#DFLT_PAGER=-DDFLT_PAGER=\"more\" # generic && reno
DFLT_PAGER=-DDFLT_PAGER=\"less\"
#DFLT_PAGER := -DDFLT_PAGER=\"more\"
DFLT_PAGER := -DDFLT_PAGER=\"less\"

# This is the name of the history file. If undefined, the history will
# not be saved.
HISTORY_FILE=-DHISTORY_FILE=\"~/.sc_history\"
HISTORY_FILE := -DHISTORY_FILE=\"~/.sc_history\"

# this is the name to save back ups in
#SAVE=-DSAVENAME=\"$(NAME).SAVE\"
#SAVE := -DSAVENAME=\"$(NAME).SAVE\"

# If you get errors about fmod being undefined when you try to
# compile, then define NO_FMOD (most likely BSD4.3 and Mt Xinu).
#FMOD=-DNO_FMOD
FMOD=
#FMOD := -DNO_FMOD

# If your system doesn't have notimeout() in curses define NONOTIMEOUT
#NO_NOTIMEOUT=-DNONOTIMEOUT
NO_NOTIMEOUT=
#NO_NOTIMEOUT := -DNONOTIMEOUT

# flags for lint
LINTFLAGS=-abchxv
#LINTFLAGS := -abchxv

# Format of quick reference guide generated by $(name)qref
# Leave undefined for normal text output.
#QREF_FMT=
QREF_FMT=-DTROFF
#QREF_FMT := -DTROFF

# *** SPECIAL NOTES ***
# For ULTRIX: define the BSD4.2 section and SIGVOID above
Expand All @@ -146,199 +134,70 @@ QREF_FMT=-DTROFF
# noticing the rows become 2, 3, 40, 41, 42... (etc).
# Known systems/terminfos w/ curses problems:
# {Esix Rev. D+, AT&T SysV3.2.1}:at386-m,xterm, HP-UX7.0:(not sure)
#IDLOKISBAD=-DIDLOKBAD
IDLOKISBAD=
#IDLOKISBAD := -DIDLOKBAD

# If you don't have idlok() in your curses define NOIDLOK
#NO_IDLOK=-DNOIDLOK
NO_IDLOK=
#NO_IDLOK := -DNOIDLOK

# If moving right off the screen causes the screen to not redraw
# properly, define RIGHT_CBUG to get around a curses problem on some
# boxes, this forces screen redraws when going right off the screen
#RIGHTBUG=-DRIGHT_CBUG
RIGHTBUG=

# IF you have problems w/ your yacc try bison, Berkeley yacc, or
# some other yacc. Some systems don't allow you to
# increase the number of terminals (mostly AT&T), SCO's does though.
# YACC=yacc
# NOTE: Do not use with bison 1.16! Get a new version....
YACC=bison -y
#RIGHTBUG := -DRIGHT_CBUG

# MS-DOS needs y_tab instead of the normal y.tab
#YTAB=y_tab
YTAB=y.tab

# Command to use to make temporary copies of some source files.
#LN=ln -s
#LN=cp
LN=ln

#########################################
# Use this for Linux
CC=gcc
# Only use -Wall for testing, since it produces warnings that are of no
# real effect on the reliability of the program, but may concern some
# people who don't understand them.
#CFLAGS=-DSYSV3 -O2 -Wall -pipe
CFLAGS=-DSYSV3 -O2 -pipe -g
#CFLAGS=-DSYSV3 -O2 -std=c89 -pipe -g
LIB=-lm -lncurses

# All of the source files
SRC=Makefile buffer.c buffer.h \
cmds.c cmds.h \
cmds_normal.c cmds_normal.h \
cmds_command.c cmds_command.h \
cmds_edit.c cmds_edit.h \
cmds_insert.c cmds_insert.h \
cmds_visual.c \
color.c color.h conf.c conf.h exec.c exec.h eres.sed \
file.c file.h format.c gram.y \
history.c history.h \
help.c input.c input.h interp.c lex.c \
main.c maps.c maps.h marks.c marks.h \
pipe.c range.c range.h \
sc.h shift.c shift.h sort.c sres.sed \
stdout.c stdout.h vmtbl.c xmalloc.c \
yank.c yank.h \
undo.c undo.h \
utils/dictionary.c utils/dictionary.h \
utils/block.c utils/block.h \
utils/extra.c utils/extra.h \
utils/string.c utils/string.h

# The objects
OBJS= buffer.o cmds.o cmds_command.o cmds_edit.o cmds_insert.o \
cmds_normal.o cmds_visual.o color.o conf.o exec.o file.o format.o gram.o help.o history.o input.o interp.o \
lex.o main.o maps.o pipe.o range.o shift.o sort.o stdout.o \
utils/extra.o marks.o yank.o undo.o utils/dictionary.o \
utils/block.o utils/string.o vmtbl.o xmalloc.o

# The documents in the Archive
#DOCS= README torev


$(name):$(PAR) $(OBJS)
$(CC) ${LDFLAGS} ${OBJS} ${LIB} -o $(name)

gram.c: gram.y
$(YACC) -d gram.y
mv $(YTAB).c gram.c

$(YTAB).h: gram.y

pvmtbl.c: vmtbl.c
-rm -f pvmtbl.c
${LN} vmtbl.c pvmtbl.c

pvmtbl.o: sc.h pvmtbl.c
$(CC) ${CFLAGS} -c -DPSC pvmtbl.c

pxmalloc.c: xmalloc.c
-rm -f pxmalloc.c
${LN} xmalloc.c pxmalloc.c








qhelp.c: help.c
-rm -f qhelp.c
${LN} help.c qhelp.c

$(name)qref: qhelp.c sc.h
$(CC) $(CFLAGS) $(LDFLAGS) -DQREF $(QREF_FMT) -DSCNAME=\"$(NAME)\" -o $(name)qref qhelp.c

help.o: sc.h help.c
$(CC) ${CFLAGS} -c help.c

all: $(name) $(name)qref

#YTAB := y_tab
YTAB := y.tab

#YACC := bison -y
SED := sed

CFLAGS := -DSYSV3 -O2 -pipe -g $(DOBACKUPS)
CFLAGS := $(CFLAGS) $(USECOLORS) $(USELOCALE) $(SIGVOID) $(DFLT_PAGER)
CFLAGS := $(CFLAGS) $(IEEE_MATH) $(RINT) $(REGEX) $(FMOD) $(LIBRARY)
CFLAGS := $(CFLAGS) $(NO_NOTIMEOUT) $(SIMPLE)
LDLIBS := -lm -lncurses

OBJS := $(patsubst %.c, %.o, $(wildcard *.c) $(wildcard utils/*.c)) gram.o

# The documents in the Archive
#DOCS := README torev

.PHONY : all clean install

#all : $(name) $(name)qref
all : $(name)

install :
install scim $(PREFIX)/scim

buffer.o: buffer.c buffer.h

cmds.o: cmds.c cmds.h sc.h
$(CC) ${CFLAGS} ${DOBACKUPS} -c cmds.c

cmds_normal.o: cmds_normal.c cmds_normal.h

cmds_command.o: cmds_command.c cmds_command.h

cmds_edit.o: cmds_edit.c cmds_edit.h

cmds_insert.o: cmds_insert.c cmds_insert.h

cmds_visual.o: cmds_visual.c

color.o: color.c color.h sc.h

exec.o: exec.c exec.h

format.o: format.c

gram.o: sc.h $(YTAB).h gram.c
$(CC) ${USECOLORS} ${CFLAGS} ${USELOCALE} -c gram.c
sed < gram.y > experres.h -f eres.sed
sed < gram.y > statres.h -f sres.sed

interp.o: interp.c sc.h
$(CC) ${CFLAGS} ${FLOAT_STORE} ${IEEE_MATH} ${SIGVOID} ${RINT} ${REGEX} ${FMOD} -c interp.c

lex.o: sc.h $(YTAB).h gram.o lex.c
$(CC) ${CFLAGS} ${SIMPLE} ${IEEE_MATH} ${LIBRARY} ${SIGVOID} ${NO_NOTIMEOUT} -c lex.c

pipe.o: pipe.c sc.h

pxmalloc.o: sc.h pxmalloc.c
$(CC) ${CFLAGS} -c -DPSC pxmalloc.c

range.o: range.c range.h sc.h

main.o: sc.h main.c
$(CC) ${CFLAGS} ${DFLT_PAGER} ${SIGVOID} -c main.c

sort.o: sort.c sc.h

conf.o: conf.c conf.h

history.o: history.c history.h

shift.o: shift.c

stdout.o: stdout.c
$(CC) ${USECOLORS} -c stdout.c

input.o: input.c

maps.o: maps.c maps.h
$(name) : $(OBJS)
$(CC) $(LDFLAGS) $^ -o $@ $(LDLIBS)

utils/extra.o: utils/extra.c utils/extra.h
$(name)qref: sc.h
$(CC) $(CFLAGS) $(LDFLAGS) -DQREF $(QREF_FMT) -DSCNAME=\"$(NAME)\" -o $(name)qref help.c $(LDLIBS)

marks.o: marks.c marks.h
$(OBJS) : $(YTAB).h experres.h statres.h

yank.o: yank.c yank.h
$(YTAB).h : gram.y

file.o: file.c file.h
gram.c $(YTAB).h : gram.y
$(YACC) -d $<
test -f $(YTAB).c && mv $(YTAB).c gram.c

undo.o: undo.c undo.h
pvmtbl.o: sc.h pvmtbl.c
$(CC) ${CFLAGS} -c -DPSC pvmtbl.c

utils/dictionary.o: utils/dictionary.c utils/dictionary.h
experres.h : gram.y
sed -f eres.sed < gram.y > experres.h

utils/block.o: utils/block.c utils/block.h
statres.h : gram.y
sed -f sres.sed < gram.y > statres.h

utils/string.o: utils/string.c utils/string.h
interp.o : interp.c
$(CC) $(CFLAGS) $(FLOAT_STORE) -c $< -o $@

clean:
rm -f utils/*.o *.o *res.h $(YTAB).h debug core gram.c y.output pxmalloc.c pvmtbl.c tags scimqref qhelp.c scim
rm -f $(OBJS)
rm -f *res.h $(YTAB).h
rm -f debug core gram.c y.output pxmalloc.c pvmtbl.c tags scimqref
rm -f qhelp.c scim

0 comments on commit 62c9664

Please sign in to comment.