6 top_srcdir = @top_srcdir@
11 DLOPEN_LIB = @DLOPEN_LIB@
22 ELF_INSTALL_DIR = $(root_libdir)
23 ELF_OTHER_LIBS = -L../.. -lcom_err $(DLOPEN_LIB)
28 BSDLIB_INSTALL_DIR = $(root_libdir)
31 COMPILE_ET=../et/compile_et --build-tree
32 MK_CMDS=_SS_DIR_OVERRIDE=. ./mk_cmds
34 # -I.. is so that ss/ss_err.h works
35 # -I$(srcdir)/.. is so that ss/ss.h works
36 # -I$(srcdir)/../et is so com_err.h works
37 XTRA_CFLAGS= -I$(srcdir)/../et
41 @$(CC) $(ALL_CFLAGS) -c $<
42 @PROFILE_CMT@ @$(CC) $(ALL_CFLAGS) -g -pg -o profiled/$*.o -c $<
43 @CHECKER_CMT@ @$(CC) $(ALL_CFLAGS) -checker -g -o checker/$*.o -c $<
44 @ELF_CMT@ @$(CC) $(ALL_CFLAGS) -DSHARED_ELF_LIB -fPIC -o elfshared/$*.o -c $<
45 @BSDLIB_CMT@ @$(CC) $(ALL_CFLAGS) $(BSDLIB_PIC_FLAG) -o pic/$*.o -c $<
49 # with ss_err.o first, ss_err.h should get rebuilt first too. should not
50 # be relying on this, though.
54 execute_cmd.o listen.o parse.o error.o prompt.o \
55 request_tbl.o list_rqs.o pager.o requests.o \
58 SRCS= $(srcdir)/invocation.c $(srcdir)/help.c \
59 $(srcdir)/execute_cmd.c $(srcdir)/listen.c $(srcdir)/parse.c \
60 $(srcdir)/error.c $(srcdir)/prompt.c $(srcdir)/request_tbl.c \
61 $(srcdir)/list_rqs.c $(srcdir)/pager.c $(srcdir)/requests.c \
62 $(srcdir)/data.c $(srcdir)/get_readline.c
72 CODE= $(SRCS) $(MKCMDSFILES)
74 MKCMDSOBJS= mk_cmds.o utils.o options.o ct.tab.o cmd_tbl.lex.o
76 MKCMDSFILES= mk_cmds.c utils.c options.c ct.y cmd_tbl.lex.l
78 MKCMDSCSRCS= mk_cmds.c utils.c options.c ct.tab.c cmd_tbl.lex.c
81 HFILES= ss.h ss_internal.h
82 SHARE_FILES= ct_c.awk ct_c.sed
86 # for 'tags' and dependencies
88 CFILES= $(SRCS) $(MKCMDSCSRCS) test_ss.c
90 # for building archives
92 FILES= $(SRCS) $(MKCMDSFILES) $(HFILES) \
93 ss_err.et std_rqs.ct Makefile \
96 all:: libss.a ss.pc # libss_p.a lint
98 std_rqs.c: std_rqs.ct mk_cmds
100 @DIR=$(srcdir) $(MK_CMDS) $(srcdir)/std_rqs.ct
104 test_cmd.c: test_cmd.ct mk_cmds
106 @DIR=$(srcdir) $(MK_CMDS) $(srcdir)/test_cmd.ct
108 ss_err.c ss_err.h: ss_err.et
109 @echo " COMPILE_ET ss_err.et"
110 @$(COMPILE_ET) $(srcdir)/ss_err.et
112 ct.tab.c ct.tab.h: ct.y
113 $(RM) -f ct.tab.* y.*
114 $(YACC) -d $(srcdir)/ct.y
115 $(MV) -f y.tab.c ct.tab.c
116 $(MV) -f y.tab.h ct.tab.h
119 # $(LD) -r -s -o $@ $(OBJS)
122 mk_cmds: $(DEP_SUBSTITUTE) $(srcdir)/mk_cmds.sh.in
124 @$(SUBSTITUTE) $(srcdir)/mk_cmds.sh.in mk_cmds
127 ss.pc: $(srcdir)/ss.pc.in $(top_builddir)/config.status
128 @echo " CONFIG.STATUS $@"
129 @cd $(top_builddir); CONFIG_FILES=lib/ss/ss.pc ./config.status
132 @echo " MKINSTALLDIRS $(libdir) $(includedir)/ss $(datadir)/ss $(bindir)"
133 @$(MKINSTALLDIRS) $(DESTDIR)$(libdir) \
134 $(DESTDIR)$(includedir)/ss $(DESTDIR)$(datadir)/ss \
135 $(DESTDIR)$(bindir) $(DESTDIR)$(libdir)/pkgconfig
137 install:: libss.a $(INSTALL_HFILES) installdirs ss_err.h mk_cmds ss.pc
138 @echo " INSTALL_DATA $(DESTDIR)$(libdir)/libss.a"
139 @$(INSTALL_DATA) libss.a $(DESTDIR)$(libdir)/libss.a
140 @-$(RANLIB) $(DESTDIR)$(libdir)/libss.a
141 @$(CHMOD) $(LIBMODE) $(DESTDIR)$(libdir)/libss.a
142 @$(RM) -f $(DESTDIR)$(includedir)/ss/*
143 @for i in $(INSTALL_HFILES); do \
144 echo " INSTALL_DATA $(DESTDIR)$(includedir)/ss/$$i"; \
145 $(INSTALL_DATA) $(srcdir)/$$i $(DESTDIR)$(includedir)/ss/$$i; \
147 @echo " INSTALL_DATA $(includedir)/ss/ss_err.h"
148 @$(INSTALL_DATA) ss_err.h $(DESTDIR)$(includedir)/ss/ss_err.h
149 @for i in $(SHARE_FILES); do \
150 echo " INSTALL_DATA $(DESTDIR)$(datadir)/ss/$$i"; \
151 $(INSTALL_DATA) $(srcdir)/$$i $(DESTDIR)$(datadir)/ss/$$i; \
153 @echo " INSTALL $(bindir)/mk_cmds"
154 @$(INSTALL) mk_cmds $(DESTDIR)$(bindir)/mk_cmds
155 @echo " INSTALL_DATA $(man1dir)/mk_cmds.1"
156 @$(INSTALL_DATA) $(srcdir)/mk_cmds.1 $(DESTDIR)$(man1dir)/mk_cmds.1
157 @echo " INSTALL_DATA $(libdir)/pkgconfig/ss.pc"
158 @$(INSTALL_DATA) ss.pc $(DESTDIR)$(libdir)/pkgconfig/ss.pc
161 $(RM) -f $(DESTDIR)$(libdir)/libss.a $(DESTDIR)$(bindir)/mk_cmds \
162 $(DESTDIR)$(libdir)/pkgconfig/ss.pc \
163 $(DESTDIR)$(man1dir)/mk_cmds.1
164 $(RM) -rf $(DESTDIR)$(includedir)/ss $(DESTDIR)$(datadir)/ss
166 test_ss: test_ss.o test_cmd.o $(DEPLIBSS) $(LIBCOM_ERR)
168 @$(CC) -o $@ test_ss.o test_cmd.o $(ALL_CFLAGS) \
169 $(LIBSS) $(LIBCOM_ERR)
172 @echo " RUN TEST test_ss"
173 -@(LD_LIBRARY_PATH=$(LIB) DYLD_LIBRARY_PATH=$(LIB) ./test_ss -f $(srcdir)/test_script > test_out 2>&1; exit 0)
174 @if diff test_out $(srcdir)/test_script_expected > test.diff; then \
175 true ; else echo "Regression test for ss library failed!"; exit 1 ; fi
178 $(RM) -f ../libss.a libss.a mk_cmds ss_err.h ss_err.c std_rqs.c \
179 tst_cmds.c test_ss test_out test.diff *.o *~ \#* *.bak core \
184 $(RM) -f .depend Makefile ss.pc \
185 $(srcdir)/TAGS $(srcdir)/Makefile.in.old
188 # Hack to parallel makes recognize dependencies correctly.
190 $(top_builddir)/lib/ss/ss_err.h: ss_err.h
194 # +++ Dependency line eater +++
196 # Makefile dependencies follow. This must be the last section in
197 # the Makefile.in file
199 invocation.o: $(srcdir)/invocation.c $(srcdir)/ss_internal.h $(srcdir)/ss.h \
200 $(top_builddir)/lib/ss/ss_err.h $(top_srcdir)/lib/et/com_err.h
201 help.o: $(srcdir)/help.c $(srcdir)/ss_internal.h $(srcdir)/ss.h \
202 $(top_builddir)/lib/ss/ss_err.h $(top_srcdir)/lib/et/com_err.h
203 execute_cmd.o: $(srcdir)/execute_cmd.c $(srcdir)/ss_internal.h $(srcdir)/ss.h \
204 $(top_builddir)/lib/ss/ss_err.h $(top_srcdir)/lib/et/com_err.h
205 listen.o: $(srcdir)/listen.c $(srcdir)/ss_internal.h $(srcdir)/ss.h \
206 $(top_builddir)/lib/ss/ss_err.h $(top_srcdir)/lib/et/com_err.h
207 parse.o: $(srcdir)/parse.c $(srcdir)/ss_internal.h $(srcdir)/ss.h \
208 $(top_builddir)/lib/ss/ss_err.h $(top_srcdir)/lib/et/com_err.h
209 error.o: $(srcdir)/error.c $(top_srcdir)/lib/et/com_err.h \
210 $(srcdir)/ss_internal.h $(srcdir)/ss.h $(top_builddir)/lib/ss/ss_err.h \
211 $(top_srcdir)/lib/et/com_err.h
212 prompt.o: $(srcdir)/prompt.c $(srcdir)/ss_internal.h $(srcdir)/ss.h \
213 $(top_builddir)/lib/ss/ss_err.h $(top_srcdir)/lib/et/com_err.h
214 request_tbl.o: $(srcdir)/request_tbl.c $(srcdir)/ss_internal.h $(srcdir)/ss.h \
215 $(top_builddir)/lib/ss/ss_err.h $(top_srcdir)/lib/et/com_err.h
216 list_rqs.o: $(srcdir)/list_rqs.c $(srcdir)/ss_internal.h $(srcdir)/ss.h \
217 $(top_builddir)/lib/ss/ss_err.h $(top_srcdir)/lib/et/com_err.h
218 pager.o: $(srcdir)/pager.c $(srcdir)/ss_internal.h $(srcdir)/ss.h \
219 $(top_builddir)/lib/ss/ss_err.h $(top_srcdir)/lib/et/com_err.h
220 requests.o: $(srcdir)/requests.c $(srcdir)/ss_internal.h $(srcdir)/ss.h \
221 $(top_builddir)/lib/ss/ss_err.h $(top_srcdir)/lib/et/com_err.h
222 data.o: $(srcdir)/data.c $(srcdir)/ss_internal.h $(srcdir)/ss.h \
223 $(top_builddir)/lib/ss/ss_err.h $(top_srcdir)/lib/et/com_err.h
224 get_readline.o: $(srcdir)/get_readline.c $(srcdir)/ss_internal.h \
225 $(srcdir)/ss.h $(top_builddir)/lib/ss/ss_err.h \
226 $(top_srcdir)/lib/et/com_err.h