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