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