1#
2# Makefile for lib/et
3#
4
5srcdir = .
6top_srcdir = ../..
7
8top_builddir = ../..
9my_dir = lib/et
10INSTALL = /usr/bin/install -c
11
12DEP_MAKEFILE = $(DEP_LIB_MAKEFILES)
13
14# Beginning of file MCONFIG
15
16all::
17
18check::
19
20SHELL = /bin/sh
21
22COMPRESS_EXT = gz bz2 bz Z
23
24prefix = /usr
25root_prefix = 
26exec_prefix = ${prefix}
27root_bindir = ${root_prefix}/bin
28root_sbindir = ${root_prefix}/sbin
29root_libdir = ${root_prefix}/lib
30datarootdir = ${prefix}/share
31bindir = ${exec_prefix}/bin
32sbindir = ${exec_prefix}/sbin
33libdir = ${exec_prefix}/lib
34datadir= ${datarootdir}
35localedir = $(datadir)/locale
36root_sysconfdir= ${root_prefix}/etc
37includedir = ${prefix}/include
38mandir = ${datarootdir}/man
39man1dir = $(mandir)/man1
40man3dir = $(mandir)/man3
41man5dir = $(mandir)/man5
42man8dir = $(mandir)/man8
43infodir = ${datarootdir}/info
44datadir = ${datarootdir}
45
46
47
48CROSS_COMPILER = mipsel-linux-
49CC = $(CROSS_COMPILER)gcc
50BUILD_CC = $(CC)
51DEFS = -DLOCALEDIR=\"$(localedir)\" -DROOT_SYSCONFDIR=\"$(root_sysconfdir)\" -DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DENABLE_HTREE=1 -DENABLE_SWAPFS=1 -DTLS= -DUSE_UUIDD=1 -DPACKAGE=\"e2fsprogs\" -DVERSION=\"0.14.1\" -DHAVE_LONG_LONG=1 -DHAVE_LONG_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OULL=1 -DHAVE_STRCASECMP=1 -DHAVE_SRANDOM=1 -DHAVE_JRAND48=1 -DHAVE_FCHOWN=1 -DHAVE_MALLINFO=1 -DHAVE_FDATASYNC=1 -DHAVE_STRNLEN=1 -DHAVE_STRPTIME=1 -DHAVE_STRDUP=1 -DHAVE_SYSCONF=1 -DHAVE_PATHCONF=1 -DHAVE_POSIX_MEMALIGN=1 -DHAVE_MEMALIGN=1 -DHAVE_VALLOC=1 -DHAVE___SECURE_GETENV=1 -DHAVE_PRCTL=1 -DHAVE_MMAP=1 -DHAVE_UTIME=1 -DHAVE_SETRESUID=1 -DHAVE_SETRESGID=1 -DHAVE_DLOPEN=1 -DHAVE_EXT2_IOCTLS=1
52CFLAGS = -g -O2
53CPPFLAGS =  -I$(top_builddir)/lib -I$(top_srcdir)/lib 
54INTL_FLAGS = 
55ALL_CFLAGS = $(CPPFLAGS) $(DEFS) $(USE_WFLAGS) $(CFLAGS) $(XTRA_CFLAGS) \
56	$(INTL_FLAGS) $(LINUX_INCLUDE) 
57LDFLAGS = 
58ALL_LDFLAGS = $(LDFLAGS)
59BUILD_CFLAGS = -g -O2
60BUILD_LDFLAGS = 
61RM = /bin/rm
62LN = /bin/ln
63LN_S = ln -s
64MV = /bin/mv
65CP = /bin/cp
66CHMOD = /bin/chmod
67AR = $(CROSS_COMPILER)ar
68AWK = gawk
69SED = /bin/sed
70PERL = /usr/bin/perl
71RANLIB = $(CROSS_COMPILER)ranlib
72STRIP = $(CROSS_COMPILER)strip
73LD = $(PURE) $(CC)
74ARUPD = $(AR) r
75ARGEN = $(AR) rc
76LDCONFIG = /sbin/ldconfig
77INSTALL_PROGRAM = ${INSTALL}
78INSTALL_DATA = ${INSTALL} -m 644
79INSTALL_SCRIPT = ${INSTALL}
80MKINSTALLDIRS = $(top_builddir)/config/mkinstalldirs
81
82#
83# Library definitions
84#
85DEVMAPPER_LIBS = 
86STATIC_DEVMAPPER_LIBS = 
87
88LIB = $(top_builddir)/lib
89LIBSS = $(LIB)/libss.a
90LIBCOM_ERR = $(LIB)/libcom_err.a
91LIBE2P = $(LIB)/libe2p.a
92LIBEXT2FS = $(LIB)/libext2fs.a
93LIBUUID = $(LIB)/libuuid.a 
94LIBBLKID = $(LIB)/libblkid.a 
95LIBINTL = 
96DEPLIBUUID = $(LIB)/libuuid.a
97DEPLIBBLKID = $(LIB)/libblkid.a
98
99STATIC_LIBSS = $(LIB)/libss.a
100STATIC_LIBCOM_ERR = $(LIB)/libcom_err.a
101STATIC_LIBE2P = $(LIB)/libe2p.a
102STATIC_LIBEXT2FS = $(LIB)/libext2fs.a
103STATIC_LIBUUID = $(LIB)/libuuid.a  
104STATIC_LIBBLKID = $(LIB)/libblkid.a $(STATIC_DEVMAPPER_LIBS)
105DEPSTATIC_LIBUUID = $(LIB)/libuuid.a
106DEPSTATIC_LIBBLKID = $(LIB)/libblkid.a
107
108PROFILED_LIBSS = $(LIB)/libss
109PROFILED_LIBCOM_ERR = $(LIB)/libcom_err
110PROFILED_LIBE2P = $(LIB)/libe2p
111PROFILED_LIBEXT2FS = $(LIB)/libext2fs
112PROFILED_LIBUUID = $(LIB)/libuuid  
113PROFILED_LIBBLKID = $(LIB)/libblkid
114DEPPROFILED_LIBUUID = $(LIB)/libuuid
115DEPPROFILED_LIBBLKID = $(LIB)/libblkid
116
117# An include directive pointing to a directory holding enough linux-like
118# include files to satisfy some programs here
119LINUX_INCLUDE=
120
121#
122# A fast substitution command for fixing up man pages, shell scripts, etc.
123#
124SUBST_CONF=$(top_builddir)/util/subst.conf
125SUBSTITUTE= $(top_builddir)/util/subst -f $(SUBST_CONF)
126SUBSTITUTE_UPTIME= $(top_builddir)/util/subst -t -f $(SUBST_CONF)
127DEP_SUBSTITUTE= $(top_builddir)/util/subst $(SUBST_CONF)
128
129$(top_builddir)/util/subst:
130	cd $(top_builddir)/util ; $(MAKE) subst
131
132#
133# Warning flags
134#
135# Run make gcc-wall to do a build with warning messages.
136#
137#
138WFLAGS=		-std=c99 -D_XOPEN_SOURCE=600 -D_GNU_SOURCE \
139			-pedantic $(WFLAGS_EXTRA) \
140			-Wall -W -Wwrite-strings -Wpointer-arith \
141			-Wcast-qual -Wcast-align -Wno-variadic-macros \
142			-Wstrict-prototypes -Wmissing-prototypes \
143			-Wformat-security  -Wformat-nonliteral \
144			-Wmissing-format-attribute -O2 -Wstrict-aliasing \
145			-Wnested-externs -Winline -DNO_INLINE_FUNCS -Wshadow \
146			-UENABLE_NLS
147
148gcc-wall-new:
149	(make USE_WFLAGS="$(WFLAGS)" > /dev/null) 2>&1 | sed -f $(top_srcdir)/util/gcc-wall-cleanup 
150
151gcc-wall:
152	make clean > /dev/null
153	make gcc-wall-new
154
155#
156# Installation user and groups
157#
158BINGRP=		bin
159BINOWN=		bin
160BINMODE=	555
161INCGRP=		bin
162INCOWN=		bin
163INCMODE=	444
164LIBOWN=		bin
165LIBGRP=		bin
166LIBMODE=	444
167MANGRP=		bin
168MANOWN=		bin
169MANMODE=	444
170
171#
172# Autoconf magic...
173#
174
175DEP_LIB_MAKEFILES = $(top_srcdir)/lib/Makefile.elf-lib  \
176	$(top_srcdir)/lib/Makefile.bsd-lib $(top_srcdir)/lib/Makefile.darwin-lib \
177	$(top_srcdir)/lib/Makefile.solaris-lib $(top_srcdir)/lib/Makefile.checker \
178	$(top_srcdir)/lib/Makefile.profile
179
180$(top_builddir)/config.status: $(top_srcdir)/configure
181	cd $(top_builddir); ./config.status --recheck
182
183$(top_builddir)/MCONFIG: $(top_srcdir)/MCONFIG.in $(top_builddir)/config.status
184	cd $(top_builddir); CONFIG_FILES=MCONFIG ./config.status
185
186$(top_builddir)/lib/substitute_sh: $(top_srcdir)/lib/substitute_sh.in \
187		$(top_builddir)/config.status
188	cd $(top_builddir); CONFIG_FILES=lib/substitute_sh ./config.status
189
190$(top_builddir)/util/subst.conf: $(top_srcdir)/util/subst.conf.in \
191		$(top_builddir)/config.status
192	cd $(top_builddir); CONFIG_FILES=util/subst.conf ./config.status
193
194Makefile: $(srcdir)/Makefile.in $(top_builddir)/MCONFIG \
195		$(DEP_MAKEFILE) $(top_builddir)/config.status
196	cd $(top_builddir); CONFIG_FILES=$(my_dir)/Makefile ./config.status
197
198#$(top_srcdir)/configure: $(top_srcdir)/configure.in
199#	cd $(top_srcdir) && autoconf
200
201#
202# Make depend magic...
203#
204
205.depend: Makefile $(SRCS) $(top_srcdir)/depfix.sed $(top_srcdir)/wordwrap.pl
206	if test -n "$(SRCS)" ; then \
207		$(CC) -M $(ALL_CFLAGS) $(SRCS) | \
208			$(SED) -f $(top_srcdir)/depfix.sed \
209			    -e 's; $(srcdir)/; $$(srcdir)/;g' \
210			    -e 's; $(top_srcdir)/; $$(top_srcdir)/;g' \
211			    -e 's; $(top_builddir)/; $$(top_builddir)/;g' \
212			    -e 's; \./; ;g' \
213			    -e '/^#/d' \
214			    -e '/^ *\\$$/d' | \
215			$(PERL) $(top_srcdir)/wordwrap.pl > .depend; \
216	else :; fi
217
218depend:: .depend
219	if test -n "$(SRCS)" ; then \
220		sed -e '/^# +++ Dependency line eater +++/,$$d' \
221			< $(srcdir)/Makefile.in | cat - .depend \
222			> $(srcdir)/Makefile.in.new; \
223	if cmp -s $(srcdir)/Makefile.in $(srcdir)/Makefile.in.new ; then \
224		$(RM) $(srcdir)/Makefile.in.new ; \
225	else \
226		$(MV) $(srcdir)/Makefile.in $(srcdir)/Makefile.in.old; \
227		$(MV) $(srcdir)/Makefile.in.new $(srcdir)/Makefile.in; \
228	fi ; else :; fi
229
230# End of file MCONFIG
231
232all:: compile_et com_err.pc
233
234OBJS= error_message.o et_name.o init_et.o com_err.o com_right.o
235SRCS = $(srcdir)/error_message.c $(srcdir)/et_name.c $(srcdir)/init_et.c \
236	$(srcdir)/com_err.c $(srcdir)/com_right.c
237
238HFILES= com_err.h
239SHARE_FILES= et_c.awk et_h.awk
240
241LIBRARY= libcom_err
242LIBDIR= et
243
244ELF_VERSION = 2.1
245ELF_SO_VERSION = 2
246ELF_IMAGE = libcom_err
247ELF_MYDIR = et
248ELF_INSTALL_DIR = $(root_libdir)
249ELF_OTHER_LIBS = 
250
251BSDLIB_VERSION = 1.1
252BSDLIB_IMAGE = libcom_err
253BSDLIB_MYDIR = et
254BSDLIB_INSTALL_DIR = $(root_libdir)
255
256#
257# what to build...
258#
259.c.o:
260	@echo "	CC $<"
261	@$(CC) $(ALL_CFLAGS) -c $< -o $@
262#	@$(CC) $(ALL_CFLAGS) -g -pg -o profiled/$*.o -c $<
263#	@$(CC) $(ALL_CFLAGS) -checker -g -o checker/$*.o -c $<
264#	@$(CC) $(ALL_CFLAGS) -fPIC -o elfshared/$*.o -c $<
265#	@$(CC) $(ALL_CFLAGS) $(BSDLIB_PIC_FLAG) -o pic/$*.o -c $<
266
267all:: subdirs $(LIBRARY).a
268
269install-shlibs::
270
271uninstall-shlibs::
272
273real-subdirs::
274
275subdirs:: Makefile
276	@$(MAKE) -s real-subdirs
277	@touch subdirs
278
279clean::
280	@$(RM) -f subdirs
281
282$(LIBRARY).a: $(OBJS)
283	@echo "	GEN_LIB $@"
284	@(if test -r $@; then $(RM) -f $@.bak && $(MV) $@ $@.bak; fi)
285	@$(ARGEN) $@ $(OBJS)
286	-@$(RANLIB) $@
287	@$(RM) -f ../$@
288	@$(LN) $@ ../$@
289
290
291compile_et: $(DEP_SUBSTITUTE) $(srcdir)/compile_et.sh.in
292	@echo "	SUBST $@"
293	@$(SUBSTITUTE) $(srcdir)/compile_et.sh.in compile_et
294	@$(CHMOD) +x compile_et
295
296com_err.ps : com_err.dvi
297com_err.dvi: com_err.texinfo
298
299com_err.pc: $(srcdir)/com_err.pc.in $(top_builddir)/config.status
300	@echo "	CONFIG.STATUS $@"
301	@cd $(top_builddir); CONFIG_FILES=lib/et/com_err.pc ./config.status
302
303#libcom_err.o:	$(LIBOBJS)
304#	$(LD) -r -s -o libcom_err.o $(LIBOBJS)
305#	chmod -x libcom_err.o
306
307TAGS:	$(SRCS)
308	$(TAGS) $(SRCS)
309
310installdirs::
311	@echo "	MKINSTALLDIRS $(libdir) $(includedir)/et $(datadir)/et $(bindir) $(man1dir) $(man3dir)"
312	@$(MKINSTALLDIRS) $(DESTDIR)$(libdir) \
313		$(DESTDIR)$(includedir)/et $(DESTDIR)$(datadir)/et \
314		$(DESTDIR)$(bindir) $(DESTDIR)$(man1dir) \
315		$(DESTDIR)$(man3dir) $(DESTDIR)$(libdir)/pkgconfig
316
317install:: compile_et libcom_err.a $(HFILES) installdirs com_err.pc
318	@echo "	INSTALL_DATA $(libdir)/libcom_err.a"
319	@$(INSTALL_DATA) libcom_err.a $(DESTDIR)$(libdir)/libcom_err.a
320	@-$(RANLIB) $(DESTDIR)$(libdir)/libcom_err.a
321	@$(CHMOD) $(LIBMODE) $(DESTDIR)$(libdir)/libcom_err.a
322	@for i in $(HFILES); do \
323		echo "	INSTALL_DATA $(includedir)/et/$$i"; \
324		$(INSTALL_DATA) $(srcdir)/$$i $(DESTDIR)$(includedir)/et/$$i; \
325	done
326	@for i in $(SHARE_FILES); do \
327		echo "	INSTALL_DATA $(datadir)/et/$$i"; \
328		$(INSTALL_DATA) $(srcdir)/$$i $(DESTDIR)$(datadir)/et/$$i; \
329	done
330	@echo "	INSTALL_SCRIPT $(bindir)/compile_et"
331	@$(INSTALL_SCRIPT) compile_et $(DESTDIR)$(bindir)/compile_et
332	@echo "	INSTALL_DATA $(man3dir)/com_err.3"
333	@$(INSTALL_DATA) $(srcdir)/com_err.3 $(DESTDIR)$(man3dir)/com_err.3
334	@echo "	INSTALL_DATA $(man1dir)/compile_et.1"
335	@$(INSTALL_DATA) $(srcdir)/compile_et.1 \
336			$(DESTDIR)$(man1dir)/compile_et.1
337	@echo "	INSTALL_DATA $(libdir)/pkgconfig/com_err.pc"
338	@$(INSTALL_DATA) com_err.pc $(DESTDIR)$(libdir)/pkgconfig/com_err.pc
339
340uninstall::
341	$(RM) -f $(DESTDIR)$(libdir)/libcom_err.a \
342		$(DESTDIR)$(bindir)/compile_et \
343		$(DESTDIR)$(libdir)/pkgconfig/com_err.pc
344	$(RM) -rf $(DESTDIR)$(includedir)/et $(DESTDIR)$(datadir)/et
345
346check:: compile_et
347	for i in $(srcdir)/test_cases/*.et ; do \
348		t=`basename $$i | sed -e 's/.et//'`; \
349		./compile_et --build-tree $$i ; \
350		diff -c $(srcdir)/test_cases/$$t.c $$t.c > $$t.failed; \
351		if [ $$? -ne 0 ]; then echo Test case $$t failed; exit 1 ; fi ; \
352		diff -c $(srcdir)/test_cases/$$t.h $$t.h >> $$t.failed; \
353		if [ $$? -ne 0 ]; then echo Test case $$t failed; exit 1 ; fi ; \
354		$(RM) -f $$t.c $$t.h $$t.failed; \
355		echo "Test case $$t succeeded" ; \
356	done
357
358clean::
359	$(RM) -f compile_et libcom_err.a libcom_err_p.a com_err.info
360	$(RM) -f $(OBJS) profiled/*
361	$(RM) -f *~ \#* *.bak *.otl *.aux *.toc *.PS *.dvi *.ps TAGS *.ln
362	$(RM) -f ../libcom_err.a ../libcom_err_p.a
363
364mostlyclean:: clean
365distclean:: clean
366	$(RM) -f .depend Makefile com_err.pc \
367		$(srcdir)/TAGS $(srcdir)/Makefile.in.old
368
369$(OBJS): subdirs
370
371# +++ Dependency line eater +++
372# 
373# Makefile dependencies follow.  This must be the last section in
374# the Makefile.in file
375#
376error_message.o: $(srcdir)/error_message.c $(srcdir)/com_err.h \
377 $(srcdir)/error_table.h $(srcdir)/internal.h
378et_name.o: $(srcdir)/et_name.c $(srcdir)/com_err.h $(srcdir)/error_table.h \
379 $(srcdir)/internal.h
380init_et.o: $(srcdir)/init_et.c $(srcdir)/com_err.h $(srcdir)/error_table.h
381com_err.o: $(srcdir)/com_err.c $(srcdir)/com_err.h $(srcdir)/error_table.h \
382 $(srcdir)/internal.h
383com_right.o: $(srcdir)/com_right.c $(srcdir)/com_err.h \
384 $(srcdir)/error_table.h
385