Home | History | Annotate | Download | only in ss
      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 = -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 MK_CMDS=	_SS_DIR_OVERRIDE=$(srcdir) ./mk_cmds
     32 COMPILE_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.
     47 OBJS=	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 
     54 SRCS=	$(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 
     60 all:: mk_cmds
     61 
     62 @MAKEFILE_LIBRARY@
     63 @MAKEFILE_ELF@
     64 @MAKEFILE_BSDLIB@
     65 @MAKEFILE_PROFILE@
     66 
     67 CODE= $(SRCS) $(MKCMDSFILES)
     68 
     69 MKCMDSOBJS=	mk_cmds.o utils.o options.o ct.tab.o cmd_tbl.lex.o
     70 
     71 MKCMDSFILES=	mk_cmds.c utils.c options.c ct.y cmd_tbl.lex.l
     72 
     73 MKCMDSCSRCS=	mk_cmds.c utils.c options.c ct.tab.c cmd_tbl.lex.c
     74 
     75 
     76 HFILES=	ss.h ss_internal.h
     77 SHARE_FILES= ct_c.awk ct_c.sed
     78 
     79 INSTALL_HFILES=	ss.h 
     80 
     81 # for 'tags' and dependencies
     82 
     83 CFILES=	$(SRCS) $(MKCMDSCSRCS) test_ss.c
     84 
     85 # for building archives
     86 
     87 FILES=	$(SRCS) $(MKCMDSFILES) $(HFILES) \
     88 	ss_err.et std_rqs.ct Makefile \
     89 	test_ss.c ss 
     90 
     91 all::	libss.a ss.pc # libss_p.a lint
     92 
     93 std_rqs.c: std_rqs.ct mk_cmds
     94 	$(E) "	MK_CMDS $@"
     95 	$(Q) DIR=$(srcdir) $(MK_CMDS) $(srcdir)/std_rqs.ct
     96 
     97 std_rqs.o: ss_err.h
     98 
     99 test_cmd.c: test_cmd.ct mk_cmds
    100 	$(E) "	MK_CMDS $@"
    101 	$(Q) DIR=$(srcdir) $(MK_CMDS) $(srcdir)/test_cmd.ct
    102 
    103 ss_err.c ss_err.h: ss_err.et
    104 	$(E) "	COMPILE_ET ss_err.et"
    105 	$(Q) $(COMPILE_ET) $(srcdir)/ss_err.et
    106 
    107 ct.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 
    117 mk_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 
    122 ss.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 
    126 installdirs::
    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 
    132 install:: 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 
    155 uninstall::
    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 
    161 test_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 
    166 check:: 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 
    172 clean::
    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 
    177 mostlyclean:: clean
    178 distclean:: 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 #
    194 invocation.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
    197 help.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
    200 execute_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
    203 listen.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
    206 parse.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
    209 error.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
    212 prompt.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
    215 request_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
    218 list_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
    221 pager.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
    224 requests.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
    227 data.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
    230 get_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