1
2# Common prefix for installation directories.
3# NOTE: This directory must exist when you start the install.
4prefix		= @prefix@
5exec_prefix	= $(prefix)
6# Where to put the executables.
7bindir		= $(exec_prefix)/bin
8# Where to put the man pages.
9manext		= 1
10mandir		= $(exec_prefix)/man/man$(manext)
11# Where to put the Info files.
12infodir		= $(prefix)/info
13# Where the source is
14srcdir		= @srcdir@
15VPATH		= @srcdir@
16
17YACC	= @YACC@
18CC	= @CC@
19CFLAGS	= @CFLAGS@
20DEFS	= @DEFS@
21LIBS	= @LIBS@
22INCLUDEDIR = -I. -I$(srcdir) @CPPFLAGS@
23LN	= @LN_S@
24RM	= rm -f
25SHELL	= /bin/sh
26INSTALL	= install
27INSTALL_PROGRAM	= $(INSTALL)
28INSTALL_DATA	= $(INSTALL)
29INSTALLFLAGS	= -c
30INSTPGMFLAGS	= -s
31
32           DEPEND = makedepend
33      DEPENDFLAGS =
34           CCLINK = $(CC)
35        LDOPTIONS = $(CDEBUGFLAGS) $(CCOPTIONS)  $(EXTRA_LDOPTIONS) $(THREADS_LDFLAGS) $(LOCAL_LDFLAGS) $(LDPRELIB)
36     CXXLDOPTIONS = $(CXXDEBUGFLAGS) $(CXXOPTIONS) $(EXTRA_LDOPTIONS) $(THREADS_CXXLDFLAGS) $(LOCAL_LDFLAGS) $(LDPRELIB)
37        MKDIRHIER = mkdirhier
38             LINT = lint
39         LINTOPTS = -axz
40        LINTFLAGS = $(LINTOPTS) -DLINT $(ALLDEFINES) $(DEPEND_DEFINES)
41
42# clear out the suffix list, then set it to what we need
43.SUFFIXES:
44.SUFFIXES: .o .c .y
45
46# Warning - edit config.h if you want to change various things...
47
48# All of the source files
49# psc.c - Convert ascii input to SC/XSpread format.
50
51SRCS =	cmds.c color.c crypt.c format.c gram.c graphic_main.c help.c \
52	interp.c lex.c matrix.c plot_XY.c plot_bar.c plot_line.c \
53	plot_pie.c plot_stk_bar.c range.c sc.c scXstuff.c screen.c \
54	search.c sort.c utils.c version.c vi.c vmtbl.c xmalloc.c
55
56OBJS =	cmds.o color.o crypt.o format.o graphic_main.o help.o interp.o \
57	matrix.o plot_XY.o plot_bar.o plot_line.o plot_pie.o \
58	plot_stk_bar.o range.o sc.o scXstuff.o screen.o search.o sort.o \
59	utils.o version.o vi.o vmtbl.o xmalloc.o
60
61HDRS =	config.h graphic_gvar.h pattern.h plot.h sc.h scXstuff.h \
62	experres.h statres.h $(YTAB).h
63
64#.c.o: $(HDRS)
65#	echo hi mom
66#	$(CC) $(INCLUDEDIR) $(CFLAGS) -c $< -o $@
67
68# MS-DOS needs y_tab instead of the normal y.tab
69#YTAB=y_tab
70YTAB=y.tab
71
72# For OSF(DEC Alpha things) add -ldnet_stub
73EXTRA_LIBRARIES = $(XLIB) -lm -lcurses -ltermcap
74
75PROGRAM = xspread
76
77all:: $(PROGRAM) p$(PROGRAM)
78
79$(PROGRAM): $(OBJS) $(DEPLIBS) gram.o lex.o
80	$(RM) $@
81	$(CCLINK) -o $@ $(LDOPTIONS) $(OBJS) gram.o lex.o $(LOCAL_LIBRARIES) $(LIBS) $(EXTRA_LOAD_FLAGS)
82
83install:: xspread
84	$(INSTALL_PROGRAM) $(INSTALLFLAGS) $(INSTPGMFLAGS) xspread $(bindir)/xspread
85
86install:: pxspread
87	$(INSTALL_PROGRAM) $(INSTALLFLAGS) $(INSTPGMFLAGS) pxspread $(bindir)/pxspread
88
89uninstall::
90	-$(RM) $(bindir)/xspread
91	-$(RM) $(bindir)/pxspread
92
93
94install.man:: xspread.man
95	$(INSTALL_DATA) $(INSTALLFLAGS) $(INSTMANFLAGS) xspread.man $(mandir)/xspread.$(manext)
96	$(INSTALL_DATA) $(INSTALLFLAGS) $(INSTMANFLAGS) pxspread.man $(mandir)/pxspread.$(manext)
97
98uninstall::
99	-$(RM) $(mandir)/xspread.$(manext)
100	-$(RM) $(mandir)/pxspread.$(manext)
101
102depend::
103	$(DEPEND) $(DEPENDFLAGS) -- $(ALLDEFINES) $(DEPEND_DEFINES) -- $(SRCS)
104
105lint:
106	$(LINT) $(LINTFLAGS) $(SRCS) $(LINTLIBS)
107lint1:
108	$(LINT) $(LINTFLAGS) $(FILE) $(LINTLIBS)
109
110#.c.o:
111#	$(CC) $(INCLUDEDIR) $(CFLAGS) -c $< -o $@
112
113$(OBJS):	$(HDRS)
114	$(RM) $@
115	$(CC) $(INCLUDEDIR) -c $(CFLAGS) $(LOCAL_DEFINES) $*.c
116
117experres.h: gram.y eres.sed
118	$(RM) experres.h
119	sed < $(srcdir)/gram.y > experres.h -f $(srcdir)/eres.sed
120
121statres.h: gram.y sres.sed
122	$(RM) statres.h
123	sed < $(srcdir)/gram.y > statres.h -f $(srcdir)/sres.sed
124
125gram.o: sc.h $(YTAB).h gram.c experres.h statres.h
126	$(CC) $(INCLUDEDIR) ${CFLAGS} -c $(srcdir)/gram.c
127
128$(YTAB).h: gram.c
129gram.c: gram.y
130	$(RM) $(YTAB).h $(YTAB).c gram.c
131	$(YACC) -d gram.y
132	mv $(YTAB).c gram.c
133
134lex.o:	sc.h $(YTAB).h gram.o lex.c
135	$(CC) $(INCLUDEDIR) ${CFLAGS} -c lex.c
136
137# 'psc' Ascii to sc format converter
138pvmtbl.o: sc.h vmtbl.c config.h
139	-$(RM) pvmtbl.c
140	${LN} vmtbl.c pvmtbl.c
141	$(CC) $(INCLUDEDIR) ${CFLAGS} -c -DPSC pvmtbl.c
142	$(RM) pvmtbl.c
143
144putils.o: sc.h utils.c config.h
145	-$(RM) putils.c
146	${LN} utils.c putils.c
147	$(CC) $(INCLUDEDIR) ${CFLAGS} -c -DPSC putils.c
148	$(RM) putils.c
149
150pxmalloc.o: sc.h xmalloc.c config.h
151	-$(RM) pxmalloc.c
152	${LN} xmalloc.c pxmalloc.c
153	$(CC) $(INCLUDEDIR) ${CFLAGS} -c -DPSC pxmalloc.c
154	$(RM) pxmalloc.c
155
156p$(PROGRAM):	psc.c pvmtbl.o pxmalloc.o putils.o version.o
157	$(CC) $(INCLUDEDIR) $(CFLAGS) ${LDFLAGS} -o $@ psc.c pvmtbl.o pxmalloc.o putils.o version.o ${PSCLIB} $(LIBS)
158
159emptyrule:
160
161clean:
162	-$(RM) *.CKP *.ln *.BAK *.bak *.o core errs
163	-$(RM) ,* *~ *.a .emacs_* tags TAGS make.log MakeOut "#"*
164	-$(RM) $(PROGRAM) p$(PROGRAM)
165
166distclean: clean
167	-$(RM) Makefile config.h
168	-$(RM) config.log config.cache
169
170maintainerclean: distclean
171	-$(RM) gram.c $(YTAB).h experres.h statres.h
172
173tags:
174	ctags *.[chy]
175
176TAGS:
177	etags *.[chy]
178
179install::
180	@echo "install in $(CURRENT_DIR) done"
181
182uninstall::
183	@echo "uninstall of $(PROGRAM) done"
184
185install.man::
186	@echo "install.man in $(CURRENT_DIR) done"
187
188install.linkkit::
189	@echo "install.linkkit in $(CURRENT_DIR) done"
190
191# finish this (like test)
192test: check
193check: $(PROGRAM)
194	cd tests; $(MAKE)
195
196# For an explanation of the following Makefile rules, see node
197# `Automatic Remaking' in GNU Autoconf documentation.
198# check to make sure configure has been run...
199Makefile: $(srcdir)/Makefile.in config.status
200	CONFIG_FILES=$@ CONFIG_HEADERS= ./config.status
201config.status: configure
202	./config.status --recheck
203# maintainer things: need to make sure config_h.in & configure are up to date
204# next 3 require GNU autoconfig to run
205configure: configure.in
206	cd $(srcdir) && autoconf
207config.h: stamp-h
208stamp-h: config_h.in config.status
209	CONFIG_FILES= CONFIG_HEADERS=config.h:config_h.in ./config.status
210	echo timestamp >stamp-h
211config.h.in: acconfig.h configure.in
212	cd $(srcdir) && autoheader
213
214includes:
215
216# -----------------------------------------------------------------------
217# dependencies generated by makedepend
218