1#
2# Makefile for lib/et
3#
4
5srcdir = @srcdir@
6top_srcdir = @top_srcdir@
7VPATH = @srcdir@
8top_builddir = ../..
9my_dir = lib/et
10INSTALL = @INSTALL@
11
12DEP_MAKEFILE = $(DEP_LIB_MAKEFILES)
13
14@MCONFIG@
15
16all:: compile_et com_err.pc
17
18OBJS= error_message.o et_name.o init_et.o com_err.o com_right.o
19SRCS = $(srcdir)/error_message.c $(srcdir)/et_name.c $(srcdir)/init_et.c \
20	$(srcdir)/com_err.c $(srcdir)/com_right.c
21
22HFILES= com_err.h
23SHARE_FILES= et_c.awk et_h.awk
24
25LIBRARY= libcom_err
26LIBDIR= et
27
28ELF_VERSION = 2.1
29ELF_SO_VERSION = 2
30ELF_IMAGE = libcom_err
31ELF_MYDIR = et
32ELF_INSTALL_DIR = $(root_libdir)
33ELF_OTHER_LIBS = @SEM_INIT_LIB@
34
35BSDLIB_VERSION = 1.1
36BSDLIB_IMAGE = libcom_err
37BSDLIB_MYDIR = et
38BSDLIB_INSTALL_DIR = $(root_libdir)
39
40#
41# what to build...
42#
43.c.o:
44	$(E) "	CC $<"
45	$(Q) $(CC) $(ALL_CFLAGS) -c $< -o $@
46	$(Q) $(CHECK_CMD) $(ALL_CFLAGS) $<
47@PROFILE_CMT@	$(Q) $(CC) $(ALL_CFLAGS) -g -pg -o profiled/$*.o -c $<
48@CHECKER_CMT@	$(Q) $(CC) $(ALL_CFLAGS) -checker -g -o checker/$*.o -c $<
49@ELF_CMT@	$(Q) $(CC) $(ALL_CFLAGS) -fPIC -o elfshared/$*.o -c $<
50@BSDLIB_CMT@	$(Q) $(CC) $(ALL_CFLAGS) $(BSDLIB_PIC_FLAG) -o pic/$*.o -c $<
51
52@MAKEFILE_LIBRARY@
53@MAKEFILE_ELF@
54@MAKEFILE_BSDLIB@
55@MAKEFILE_PROFILE@
56@MAKEFILE_CHECKER@
57
58compile_et: $(DEP_SUBSTITUTE) $(srcdir)/compile_et.sh.in
59	$(E) "	SUBST $@"
60	$(Q) $(SUBSTITUTE) $(srcdir)/compile_et.sh.in compile_et
61	$(Q) $(CHMOD) +x compile_et
62
63DVI=texi2dvi
64DVIPS=dvips -o "$@"
65INFO=@MAKEINFO@
66HTML=makeinfo --html --no-split
67PS2PDF=ps2pdf
68
69com_err.ps : com_err.dvi
70com_err.dvi: com_err.texinfo
71
72com_err.info: $(srcdir)/com_err.texinfo
73	$(E) "	MAKEINFO $@"
74	-$(Q) $(INFO) $(srcdir)/com_err.texinfo
75
76com_err.dvi: $(srcdir)/com_err.texinfo
77	$(E) "	TEXI2DVI $@"
78	-$(Q) $(DVI) $(srcdir)/com_err.texinfo
79
80com_err.ps: com_err.dvi
81	$(E) "	DVIPS $@"
82	-$(Q) $(DVIPS) com_err.dvi
83
84com_err.pdf: com_err.ps
85	$(E) "	PS2PDF $@"
86	-$(Q) $(PS2PDF) com_err.ps
87
88com_err.html: $(srcdir)/com_err.texinfo
89	$(E) "	MAKEINFO $@"
90	-$(Q) $(HTML) $(srcdir)/com_err.texinfo
91
92com_err.pc: $(srcdir)/com_err.pc.in $(top_builddir)/config.status
93	$(E) "	CONFIG.STATUS $@"
94	$(Q) cd $(top_builddir); CONFIG_FILES=lib/et/com_err.pc ./config.status
95
96#libcom_err.o:	$(LIBOBJS)
97#	$(LD) -r -s -o libcom_err.o $(LIBOBJS)
98#	chmod -x libcom_err.o
99
100TAGS:	$(SRCS)
101	$(TAGS) $(SRCS)
102
103installdirs::
104	$(E) "	MKINSTALLDIRS $(libdir) $(includedir)/et $(datadir)/et $(bindir) $(man1dir) $(man3dir)"
105	$(Q) $(MKINSTALLDIRS) $(DESTDIR)$(libdir) \
106		$(DESTDIR)$(includedir)/et $(DESTDIR)$(datadir)/et \
107		$(DESTDIR)$(bindir) $(DESTDIR)$(man1dir) \
108		$(DESTDIR)$(man3dir) $(DESTDIR)$(libdir)/pkgconfig
109
110install:: compile_et libcom_err.a $(HFILES) installdirs com_err.pc
111	$(E) "	INSTALL_DATA $(libdir)/libcom_err.a"
112	$(Q) $(INSTALL_DATA) libcom_err.a $(DESTDIR)$(libdir)/libcom_err.a
113	-$(Q) $(RANLIB) $(DESTDIR)$(libdir)/libcom_err.a
114	$(Q) $(CHMOD) $(LIBMODE) $(DESTDIR)$(libdir)/libcom_err.a
115	$(Q) for i in $(HFILES); do \
116		echo "	INSTALL_DATA $(includedir)/et/$$i"; \
117		$(INSTALL_DATA) $(srcdir)/$$i $(DESTDIR)$(includedir)/et/$$i; \
118	done
119	$(Q) (cd $(DESTDIR)$(includedir) ;\
120		$(LN) $(LINK_INSTALL_FLAGS) et/com_err.h . )
121	$(Q) for i in $(SHARE_FILES); do \
122		echo "	INSTALL_DATA $(datadir)/et/$$i"; \
123		$(INSTALL_DATA) $(srcdir)/$$i $(DESTDIR)$(datadir)/et/$$i; \
124	done
125	$(E) "	INSTALL_SCRIPT $(bindir)/compile_et"
126	$(Q) $(INSTALL_SCRIPT) compile_et $(DESTDIR)$(bindir)/compile_et
127	$(E) "	INSTALL_DATA $(man3dir)/com_err.3"
128	$(Q) $(INSTALL_DATA) $(srcdir)/com_err.3 $(DESTDIR)$(man3dir)/com_err.3
129	$(E) "	INSTALL_DATA $(man1dir)/compile_et.1"
130	$(Q) $(INSTALL_DATA) $(srcdir)/compile_et.1 \
131			$(DESTDIR)$(man1dir)/compile_et.1
132	$(E) "	INSTALL_DATA $(libdir)/pkgconfig/com_err.pc"
133	$(Q) $(INSTALL_DATA) com_err.pc $(DESTDIR)$(libdir)/pkgconfig/com_err.pc
134
135uninstall::
136	$(RM) -f $(DESTDIR)$(libdir)/libcom_err.a \
137		$(DESTDIR)$(bindir)/compile_et \
138		$(DESTDIR)$(libdir)/pkgconfig/com_err.pc
139	$(RM) -rf $(DESTDIR)$(includedir)/et $(DESTDIR)$(datadir)/et
140
141check:: compile_et
142	for i in $(srcdir)/test_cases/*.et ; do \
143		t=`basename $$i | sed -e 's/.et//'`; \
144		./compile_et --build-tree $$i ; \
145		diff -c $(srcdir)/test_cases/$$t.c $$t.c > $$t.failed; \
146		if [ $$? -ne 0 ]; then echo Test case $$t failed; exit 1 ; fi ; \
147		diff -c $(srcdir)/test_cases/$$t.h $$t.h >> $$t.failed; \
148		if [ $$? -ne 0 ]; then echo Test case $$t failed; exit 1 ; fi ; \
149		$(RM) -f $$t.c $$t.h $$t.failed; \
150		echo "Test case $$t succeeded" ; \
151	done
152
153clean::
154	$(RM) -f compile_et libcom_err.a libcom_err_p.a com_err.info
155	$(RM) -f $(OBJS) profiled/*
156	$(RM) -f *~ \#* *.bak *.otl *.aux *.toc *.PS *.dvi *.ps TAGS *.ln \
157		*.html *.cp *.fn *.fns *.ky *.log *.pc *.pg *.toc *.tp *.vr \
158		*.pdf
159	$(RM) -f ../libcom_err.a ../libcom_err_p.a
160
161mostlyclean:: clean
162distclean:: clean
163	$(RM) -f .depend Makefile com_err.pc \
164		$(srcdir)/TAGS $(srcdir)/Makefile.in.old
165
166$(OBJS): subdirs
167
168# +++ Dependency line eater +++
169#
170# Makefile dependencies follow.  This must be the last section in
171# the Makefile.in file
172#
173error_message.o: $(srcdir)/error_message.c $(top_builddir)/lib/config.h \
174 $(top_builddir)/lib/dirpaths.h $(srcdir)/com_err.h $(srcdir)/error_table.h \
175 $(srcdir)/internal.h
176et_name.o: $(srcdir)/et_name.c $(top_builddir)/lib/config.h \
177 $(top_builddir)/lib/dirpaths.h $(srcdir)/com_err.h $(srcdir)/error_table.h \
178 $(srcdir)/internal.h
179init_et.o: $(srcdir)/init_et.c $(top_builddir)/lib/config.h \
180 $(top_builddir)/lib/dirpaths.h $(srcdir)/com_err.h $(srcdir)/error_table.h
181com_err.o: $(srcdir)/com_err.c $(top_builddir)/lib/config.h \
182 $(top_builddir)/lib/dirpaths.h $(srcdir)/com_err.h $(srcdir)/error_table.h \
183 $(srcdir)/internal.h
184com_right.o: $(srcdir)/com_right.c $(top_builddir)/lib/config.h \
185 $(top_builddir)/lib/dirpaths.h $(srcdir)/com_err.h $(srcdir)/error_table.h
186