1# 2# Makefile for lib/ss 3# 4 5srcdir = @srcdir@ 6top_srcdir = @top_srcdir@ 7VPATH = @srcdir@ 8top_builddir = ../.. 9my_dir = lib/ss 10INSTALL = @INSTALL@ 11DLOPEN_LIB = @DLOPEN_LIB@ 12 13@MCONFIG@ 14 15LIBRARY= libss 16LIBDIR= ss 17 18ELF_VERSION = 2.0 19ELF_SO_VERSION = 2 20ELF_IMAGE = libss 21ELF_MYDIR = ss 22ELF_INSTALL_DIR = $(root_libdir) 23ELF_OTHER_LIBS = -lcom_err $(DLOPEN_LIB) 24 25BSDLIB_VERSION = 1.0 26BSDLIB_IMAGE = libss 27BSDLIB_MYDIR = ss 28BSDLIB_INSTALL_DIR = $(root_libdir) 29 30TAGS=etags 31MK_CMDS= _SS_DIR_OVERRIDE=$(srcdir) ./mk_cmds 32COMPILE_ET= _ET_DIR_OVERRIDE=$(srcdir)/../et ../et/compile_et 33 34.c.o: 35 $(E) " CC $<" 36 $(Q) $(CC) $(ALL_CFLAGS_STLIB) -c $< 37 $(Q) $(CHECK_CMD) $(ALL_CFLAGS) $< 38 $(Q) $(CPPCHECK_CMD) $(CPPFLAGS) $< 39@PROFILE_CMT@ $(Q) $(CC) $(ALL_CFLAGS_STLIB) -g -pg -o profiled/$*.o -c $< 40@ELF_CMT@ $(Q) $(CC) $(ALL_CFLAGS_SHLIB) -DSHARED_ELF_LIB -fPIC -shared -o elfshared/$*.o -c $< 41@BSDLIB_CMT@ $(Q) $(CC) $(ALL_CFLAGS_SHLIB) $(BSDLIB_PIC_FLAG) -o pic/$*.o -c $< 42 43# for the library 44 45# with ss_err.o first, ss_err.h should get rebuilt first too. should not 46# be relying on this, though. 47OBJS= ss_err.o \ 48 std_rqs.o \ 49 invocation.o help.o \ 50 execute_cmd.o listen.o parse.o error.o prompt.o \ 51 request_tbl.o list_rqs.o pager.o requests.o \ 52 data.o get_readline.o 53 54SRCS= $(srcdir)/invocation.c $(srcdir)/help.c \ 55 $(srcdir)/execute_cmd.c $(srcdir)/listen.c $(srcdir)/parse.c \ 56 $(srcdir)/error.c $(srcdir)/prompt.c $(srcdir)/request_tbl.c \ 57 $(srcdir)/list_rqs.c $(srcdir)/pager.c $(srcdir)/requests.c \ 58 $(srcdir)/data.c $(srcdir)/get_readline.c 59 60all:: mk_cmds 61 62@MAKEFILE_LIBRARY@ 63@MAKEFILE_ELF@ 64@MAKEFILE_BSDLIB@ 65@MAKEFILE_PROFILE@ 66 67CODE= $(SRCS) $(MKCMDSFILES) 68 69MKCMDSOBJS= mk_cmds.o utils.o options.o ct.tab.o cmd_tbl.lex.o 70 71MKCMDSFILES= mk_cmds.c utils.c options.c ct.y cmd_tbl.lex.l 72 73MKCMDSCSRCS= mk_cmds.c utils.c options.c ct.tab.c cmd_tbl.lex.c 74 75 76HFILES= ss.h ss_internal.h 77SHARE_FILES= ct_c.awk ct_c.sed 78 79INSTALL_HFILES= ss.h 80 81# for 'tags' and dependencies 82 83CFILES= $(SRCS) $(MKCMDSCSRCS) test_ss.c 84 85# for building archives 86 87FILES= $(SRCS) $(MKCMDSFILES) $(HFILES) \ 88 ss_err.et std_rqs.ct Makefile \ 89 test_ss.c ss 90 91all:: libss.a ss.pc # libss_p.a lint 92 93std_rqs.c: std_rqs.ct mk_cmds 94 $(E) " MK_CMDS $@" 95 $(Q) DIR=$(srcdir) $(MK_CMDS) $(srcdir)/std_rqs.ct 96 97std_rqs.o: ss_err.h 98 99test_cmd.c: test_cmd.ct mk_cmds 100 $(E) " MK_CMDS $@" 101 $(Q) DIR=$(srcdir) $(MK_CMDS) $(srcdir)/test_cmd.ct 102 103ss_err.c ss_err.h: ss_err.et 104 $(E) " COMPILE_ET ss_err.et" 105 $(Q) $(COMPILE_ET) $(srcdir)/ss_err.et 106 107ct.tab.c ct.tab.h: ct.y 108 $(RM) -f ct.tab.* y.* 109 $(YACC) -d $(srcdir)/ct.y 110 $(MV) -f y.tab.c ct.tab.c 111 $(MV) -f y.tab.h ct.tab.h 112 113#libss.o: $(OBJS) 114# $(LD) -r -s -o $@ $(OBJS) 115# $(CHMOD) -x $@ 116 117mk_cmds: $(DEP_SUBSTITUTE) $(srcdir)/mk_cmds.sh.in 118 $(E) " SUBST $@" 119 $(Q) $(SUBSTITUTE) $(srcdir)/mk_cmds.sh.in mk_cmds 120 $(Q) $(CHMOD) +x mk_cmds 121 122ss.pc: $(srcdir)/ss.pc.in $(top_builddir)/config.status 123 $(E) " CONFIG.STATUS $@" 124 $(Q) cd $(top_builddir); CONFIG_FILES=lib/ss/ss.pc ./config.status 125 126installdirs:: 127 $(E) " MKINSTALLDIRS $(libdir) $(includedir)/ss $(datadir)/ss $(bindir)" 128 $(Q) $(MKINSTALLDIRS) $(DESTDIR)$(libdir) \ 129 $(DESTDIR)$(includedir)/ss $(DESTDIR)$(datadir)/ss \ 130 $(DESTDIR)$(bindir) $(DESTDIR)$(pkgconfigdir) 131 132install:: libss.a $(INSTALL_HFILES) installdirs ss_err.h mk_cmds ss.pc 133 $(E) " INSTALL_DATA $(DESTDIR)$(libdir)/libss.a" 134 $(Q) $(INSTALL_DATA) libss.a $(DESTDIR)$(libdir)/libss.a 135 -$(Q) $(RANLIB) $(DESTDIR)$(libdir)/libss.a 136 $(Q) $(CHMOD) $(LIBMODE) $(DESTDIR)$(libdir)/libss.a 137 $(Q) $(RM) -f $(DESTDIR)$(includedir)/ss/* 138 $(Q) for i in $(INSTALL_HFILES); do \ 139 echo " INSTALL_DATA $(DESTDIR)$(includedir)/ss/$$i"; \ 140 $(INSTALL_DATA) $(srcdir)/$$i $(DESTDIR)$(includedir)/ss/$$i; \ 141 done 142 $(E) " INSTALL_DATA $(includedir)/ss/ss_err.h" 143 $(Q) $(INSTALL_DATA) ss_err.h $(DESTDIR)$(includedir)/ss/ss_err.h 144 $(Q) for i in $(SHARE_FILES); do \ 145 echo " INSTALL_DATA $(DESTDIR)$(datadir)/ss/$$i"; \ 146 $(INSTALL_DATA) $(srcdir)/$$i $(DESTDIR)$(datadir)/ss/$$i; \ 147 done 148 $(E) " INSTALL $(bindir)/mk_cmds" 149 $(Q) $(INSTALL) mk_cmds $(DESTDIR)$(bindir)/mk_cmds 150 $(E) " INSTALL_DATA $(man1dir)/mk_cmds.1" 151 $(Q) $(INSTALL_DATA) $(srcdir)/mk_cmds.1 $(DESTDIR)$(man1dir)/mk_cmds.1 152 $(E) " INSTALL_DATA $(pkgconfigdir)/ss.pc" 153 $(Q) $(INSTALL_DATA) ss.pc $(DESTDIR)$(pkgconfigdir)/ss.pc 154 155uninstall:: 156 $(RM) -f $(DESTDIR)$(libdir)/libss.a $(DESTDIR)$(bindir)/mk_cmds \ 157 $(DESTDIR)$(pkgconfigdir)/ss.pc \ 158 $(DESTDIR)$(man1dir)/mk_cmds.1 159 $(RM) -rf $(DESTDIR)$(includedir)/ss $(DESTDIR)$(datadir)/ss 160 161test_ss: test_ss.o test_cmd.o $(DEPLIBSS) $(DEPLIBCOM_ERR) 162 $(E) " LD $@" 163 $(Q) $(CC) -o $@ test_ss.o test_cmd.o $(ALL_CFLAGS) $(ALL_LDFLAGS) \ 164 $(LIBSS) $(LIBCOM_ERR) $(SYSLIBS) 165 166check:: all test_ss 167 $(E) " RUN TEST test_ss" 168 -@($(TESTENV) ./test_ss -f $(srcdir)/test_script > test_out 2>&1; exit 0) 169 $(Q) if diff test_out $(srcdir)/test_script_expected > test.diff; then \ 170 true ; else echo "Regression test for ss library failed!"; exit 1 ; fi 171 172clean:: 173 $(RM) -f ../libss.a libss.a mk_cmds ss_err.h ss_err.c std_rqs.c \ 174 tst_cmds.c test_ss test_out test.diff *.o *~ \#* *.bak core \ 175 test_cmd.c ss.pc 176 177mostlyclean:: clean 178distclean:: clean 179 $(RM) -f .depend Makefile ss.pc \ 180 $(srcdir)/TAGS $(srcdir)/Makefile.in.old 181 182# 183# Hack to parallel makes recognize dependencies correctly. 184# 185$(top_builddir)/lib/ss/ss_err.h: ss_err.h 186 187$(OBJS): subdirs 188 189# +++ Dependency line eater +++ 190# 191# Makefile dependencies follow. This must be the last section in 192# the Makefile.in file 193# 194invocation.o: $(srcdir)/invocation.c $(top_builddir)/lib/config.h \ 195 $(top_builddir)/lib/dirpaths.h $(srcdir)/ss_internal.h $(srcdir)/ss.h \ 196 $(top_builddir)/lib/ss/ss_err.h $(top_srcdir)/lib/et/com_err.h 197help.o: $(srcdir)/help.c $(top_builddir)/lib/config.h \ 198 $(top_builddir)/lib/dirpaths.h $(srcdir)/ss_internal.h $(srcdir)/ss.h \ 199 $(top_builddir)/lib/ss/ss_err.h $(top_srcdir)/lib/et/com_err.h 200execute_cmd.o: $(srcdir)/execute_cmd.c $(top_builddir)/lib/config.h \ 201 $(top_builddir)/lib/dirpaths.h $(srcdir)/ss_internal.h $(srcdir)/ss.h \ 202 $(top_builddir)/lib/ss/ss_err.h $(top_srcdir)/lib/et/com_err.h 203listen.o: $(srcdir)/listen.c $(top_builddir)/lib/config.h \ 204 $(top_builddir)/lib/dirpaths.h $(srcdir)/ss_internal.h $(srcdir)/ss.h \ 205 $(top_builddir)/lib/ss/ss_err.h $(top_srcdir)/lib/et/com_err.h 206parse.o: $(srcdir)/parse.c $(top_builddir)/lib/config.h \ 207 $(top_builddir)/lib/dirpaths.h $(srcdir)/ss_internal.h $(srcdir)/ss.h \ 208 $(top_builddir)/lib/ss/ss_err.h $(top_srcdir)/lib/et/com_err.h 209error.o: $(srcdir)/error.c $(top_builddir)/lib/config.h \ 210 $(top_builddir)/lib/dirpaths.h $(top_srcdir)/lib/et/com_err.h \ 211 $(srcdir)/ss_internal.h $(srcdir)/ss.h $(top_builddir)/lib/ss/ss_err.h 212prompt.o: $(srcdir)/prompt.c $(top_builddir)/lib/config.h \ 213 $(top_builddir)/lib/dirpaths.h $(srcdir)/ss_internal.h $(srcdir)/ss.h \ 214 $(top_builddir)/lib/ss/ss_err.h $(top_srcdir)/lib/et/com_err.h 215request_tbl.o: $(srcdir)/request_tbl.c $(top_builddir)/lib/config.h \ 216 $(top_builddir)/lib/dirpaths.h $(srcdir)/ss_internal.h $(srcdir)/ss.h \ 217 $(top_builddir)/lib/ss/ss_err.h $(top_srcdir)/lib/et/com_err.h 218list_rqs.o: $(srcdir)/list_rqs.c $(top_builddir)/lib/config.h \ 219 $(top_builddir)/lib/dirpaths.h $(srcdir)/ss_internal.h $(srcdir)/ss.h \ 220 $(top_builddir)/lib/ss/ss_err.h $(top_srcdir)/lib/et/com_err.h 221pager.o: $(srcdir)/pager.c $(top_builddir)/lib/config.h \ 222 $(top_builddir)/lib/dirpaths.h $(srcdir)/ss_internal.h $(srcdir)/ss.h \ 223 $(top_builddir)/lib/ss/ss_err.h $(top_srcdir)/lib/et/com_err.h 224requests.o: $(srcdir)/requests.c $(top_builddir)/lib/config.h \ 225 $(top_builddir)/lib/dirpaths.h $(srcdir)/ss_internal.h $(srcdir)/ss.h \ 226 $(top_builddir)/lib/ss/ss_err.h $(top_srcdir)/lib/et/com_err.h 227data.o: $(srcdir)/data.c $(top_builddir)/lib/config.h \ 228 $(top_builddir)/lib/dirpaths.h $(srcdir)/ss_internal.h $(srcdir)/ss.h \ 229 $(top_builddir)/lib/ss/ss_err.h $(top_srcdir)/lib/et/com_err.h 230get_readline.o: $(srcdir)/get_readline.c $(top_builddir)/lib/config.h \ 231 $(top_builddir)/lib/dirpaths.h $(srcdir)/ss_internal.h $(srcdir)/ss.h \ 232 $(top_builddir)/lib/ss/ss_err.h $(top_srcdir)/lib/et/com_err.h 233