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 = -L../.. -lcom_err $(DLOPEN_LIB) 24 25BSDLIB_VERSION = 1.0 26BSDLIB_IMAGE = libss 27BSDLIB_MYDIR = ss 28BSDLIB_INSTALL_DIR = $(root_libdir) 29 30TAGS=etags 31COMPILE_ET=../et/compile_et --build-tree 32MK_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 37XTRA_CFLAGS= -I$(srcdir)/../et 38 39.c.o: 40 @echo " CC $<" 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 $< 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. 51OBJS= 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 58SRCS= $(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 64all:: mk_cmds 65 66@MAKEFILE_LIBRARY@ 67@MAKEFILE_ELF@ 68@MAKEFILE_BSDLIB@ 69@MAKEFILE_PROFILE@ 70@MAKEFILE_CHECKER@ 71 72CODE= $(SRCS) $(MKCMDSFILES) 73 74MKCMDSOBJS= mk_cmds.o utils.o options.o ct.tab.o cmd_tbl.lex.o 75 76MKCMDSFILES= mk_cmds.c utils.c options.c ct.y cmd_tbl.lex.l 77 78MKCMDSCSRCS= mk_cmds.c utils.c options.c ct.tab.c cmd_tbl.lex.c 79 80 81HFILES= ss.h ss_internal.h 82SHARE_FILES= ct_c.awk ct_c.sed 83 84INSTALL_HFILES= ss.h 85 86# for 'tags' and dependencies 87 88CFILES= $(SRCS) $(MKCMDSCSRCS) test_ss.c 89 90# for building archives 91 92FILES= $(SRCS) $(MKCMDSFILES) $(HFILES) \ 93 ss_err.et std_rqs.ct Makefile \ 94 test_ss.c ss 95 96all:: libss.a ss.pc # libss_p.a lint 97 98std_rqs.c: std_rqs.ct mk_cmds 99 @echo " MK_CMDS $@" 100 @DIR=$(srcdir) $(MK_CMDS) $(srcdir)/std_rqs.ct 101 102std_rqs.o: ss_err.h 103 104test_cmd.c: test_cmd.ct mk_cmds 105 @echo " MK_CMDS $@" 106 @DIR=$(srcdir) $(MK_CMDS) $(srcdir)/test_cmd.ct 107 108ss_err.c ss_err.h: ss_err.et 109 @echo " COMPILE_ET ss_err.et" 110 @$(COMPILE_ET) $(srcdir)/ss_err.et 111 112ct.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 122mk_cmds: $(DEP_SUBSTITUTE) $(srcdir)/mk_cmds.sh.in 123 @echo " SUBST $@" 124 @$(SUBSTITUTE) $(srcdir)/mk_cmds.sh.in mk_cmds 125 @$(CHMOD) +x mk_cmds 126 127ss.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 130 131installdirs:: 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 136 137install:: 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; \ 146 done 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; \ 152 done 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 159 160uninstall:: 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 166test_ss: test_ss.o test_cmd.o $(LIBSS) $(LIBCOM_ERR) 167 @echo " LD $@" 168 @$(CC) -o $@ test_ss.o test_cmd.o $(ALL_CFLAGS) \ 169 $(LIBSS) $(LIBCOM_ERR) 170 171check:: all test_ss 172 @echo " RUN TEST test_ss" 173 @(LD_LIBRARY_PATH=$(LIB) DYLD_LIBRARY_PATH=$(LIB) ./test_ss -f $(srcdir)/test_script >& test_out; exit 0) 174 @if ! diff test_out $(srcdir)/test_script_expected > test.diff; then \ 175 echo "Regression test for ss library failed!"; exit 1 ; fi 176 177clean:: 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 182mostlyclean:: clean 183distclean:: 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# 199invocation.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 201help.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 203execute_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 205listen.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 207parse.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 209error.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 212prompt.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 214request_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 216list_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 218pager.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 220requests.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 222data.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 224get_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