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 = 
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	@echo "	CC $<"
45	@$(CC) $(ALL_CFLAGS) -c $< -o $@
46@PROFILE_CMT@	@$(CC) $(ALL_CFLAGS) -g -pg -o profiled/$*.o -c $<
47@CHECKER_CMT@	@$(CC) $(ALL_CFLAGS) -checker -g -o checker/$*.o -c $<
48@ELF_CMT@	@$(CC) $(ALL_CFLAGS) -fPIC -o elfshared/$*.o -c $<
49@BSDLIB_CMT@	@$(CC) $(ALL_CFLAGS) $(BSDLIB_PIC_FLAG) -o pic/$*.o -c $<
50
51@MAKEFILE_LIBRARY@
52@MAKEFILE_ELF@
53@MAKEFILE_BSDLIB@
54@MAKEFILE_PROFILE@
55@MAKEFILE_CHECKER@
56
57compile_et: $(DEP_SUBSTITUTE) $(srcdir)/compile_et.sh.in
58	@echo "	SUBST $@"
59	@$(SUBSTITUTE) $(srcdir)/compile_et.sh.in compile_et
60	@$(CHMOD) +x compile_et
61
62com_err.ps : com_err.dvi
63com_err.dvi: com_err.texinfo
64
65com_err.pc: $(srcdir)/com_err.pc.in $(top_builddir)/config.status
66	@echo "	CONFIG.STATUS $@"
67	@cd $(top_builddir); CONFIG_FILES=lib/et/com_err.pc ./config.status
68
69#libcom_err.o:	$(LIBOBJS)
70#	$(LD) -r -s -o libcom_err.o $(LIBOBJS)
71#	chmod -x libcom_err.o
72
73TAGS:	$(SRCS)
74	$(TAGS) $(SRCS)
75
76installdirs::
77	@echo "	MKINSTALLDIRS $(libdir) $(includedir)/et $(datadir)/et $(bindir) $(man1dir) $(man3dir)"
78	@$(MKINSTALLDIRS) $(DESTDIR)$(libdir) \
79		$(DESTDIR)$(includedir)/et $(DESTDIR)$(datadir)/et \
80		$(DESTDIR)$(bindir) $(DESTDIR)$(man1dir) \
81		$(DESTDIR)$(man3dir) $(DESTDIR)$(libdir)/pkgconfig
82
83install:: compile_et libcom_err.a $(HFILES) installdirs com_err.pc
84	@echo "	INSTALL_DATA $(libdir)/libcom_err.a"
85	@$(INSTALL_DATA) libcom_err.a $(DESTDIR)$(libdir)/libcom_err.a
86	@-$(RANLIB) $(DESTDIR)$(libdir)/libcom_err.a
87	@$(CHMOD) $(LIBMODE) $(DESTDIR)$(libdir)/libcom_err.a
88	@for i in $(HFILES); do \
89		echo "	INSTALL_DATA $(includedir)/et/$$i"; \
90		$(INSTALL_DATA) $(srcdir)/$$i $(DESTDIR)$(includedir)/et/$$i; \
91	done
92	@for i in $(SHARE_FILES); do \
93		echo "	INSTALL_DATA $(datadir)/et/$$i"; \
94		$(INSTALL_DATA) $(srcdir)/$$i $(DESTDIR)$(datadir)/et/$$i; \
95	done
96	@echo "	INSTALL_SCRIPT $(bindir)/compile_et"
97	@$(INSTALL_SCRIPT) compile_et $(DESTDIR)$(bindir)/compile_et
98	@echo "	INSTALL_DATA $(man3dir)/com_err.3"
99	@$(INSTALL_DATA) $(srcdir)/com_err.3 $(DESTDIR)$(man3dir)/com_err.3
100	@echo "	INSTALL_DATA $(man1dir)/compile_et.1"
101	@$(INSTALL_DATA) $(srcdir)/compile_et.1 \
102			$(DESTDIR)$(man1dir)/compile_et.1
103	@echo "	INSTALL_DATA $(libdir)/pkgconfig/com_err.pc"
104	@$(INSTALL_DATA) com_err.pc $(DESTDIR)$(libdir)/pkgconfig/com_err.pc
105
106uninstall::
107	$(RM) -f $(DESTDIR)$(libdir)/libcom_err.a \
108		$(DESTDIR)$(bindir)/compile_et \
109		$(DESTDIR)$(libdir)/pkgconfig/com_err.pc
110	$(RM) -rf $(DESTDIR)$(includedir)/et $(DESTDIR)$(datadir)/et
111
112check:: compile_et
113	for i in $(srcdir)/test_cases/*.et ; do \
114		t=`basename $$i | sed -e 's/.et//'`; \
115		./compile_et --build-tree $$i ; \
116		diff -c $(srcdir)/test_cases/$$t.c $$t.c > $$t.failed; \
117		if [ $$? -ne 0 ]; then echo Test case $$t failed; exit 1 ; fi ; \
118		diff -c $(srcdir)/test_cases/$$t.h $$t.h >> $$t.failed; \
119		if [ $$? -ne 0 ]; then echo Test case $$t failed; exit 1 ; fi ; \
120		$(RM) -f $$t.c $$t.h $$t.failed; \
121		echo "Test case $$t succeeded" ; \
122	done
123
124clean::
125	$(RM) -f compile_et libcom_err.a libcom_err_p.a com_err.info
126	$(RM) -f $(OBJS) profiled/*
127	$(RM) -f *~ \#* *.bak *.otl *.aux *.toc *.PS *.dvi *.ps TAGS *.ln
128	$(RM) -f ../libcom_err.a ../libcom_err_p.a
129
130mostlyclean:: clean
131distclean:: clean
132	$(RM) -f .depend Makefile com_err.pc \
133		$(srcdir)/TAGS $(srcdir)/Makefile.in.old
134
135$(OBJS): subdirs
136
137# +++ Dependency line eater +++
138# 
139# Makefile dependencies follow.  This must be the last section in
140# the Makefile.in file
141#
142error_message.o: $(srcdir)/error_message.c $(srcdir)/com_err.h \
143 $(srcdir)/error_table.h $(srcdir)/internal.h
144et_name.o: $(srcdir)/et_name.c $(srcdir)/com_err.h $(srcdir)/error_table.h \
145 $(srcdir)/internal.h
146init_et.o: $(srcdir)/init_et.c $(srcdir)/com_err.h $(srcdir)/error_table.h
147com_err.o: $(srcdir)/com_err.c $(srcdir)/com_err.h $(srcdir)/error_table.h \
148 $(srcdir)/internal.h
149com_right.o: $(srcdir)/com_right.c $(srcdir)/com_err.h \
150 $(srcdir)/error_table.h
151