Browse Source

2003-05-11 Andreas Schwab <schwab@suse.de>

* Makerules: Always use -MP together with -MD.
	(sed-remove-dotot): Substitute $(..) also at start of line.
	($(stdio_lim:h=st)): Use -MD instead of SUNPRO_DEPENDENCIES.
	Generated defines with a single compiler call.
	Use $(sed-remove-dotdot).
	* mach/Makefile ($(objpfx)mach-syscalls.mk): Use -MD instead
	of DEPENDENCIES_OUTPUT, and use $(sed-remove-objpfx).
	* sysdeps/unix/sysv/linux/Makefile ($(objpfx)syscall-%.h):
	Use -MD instead of SUNPRO_DEPENDENCIES, and use $(sed-remove-objpfx).
	* sysdeps/unix/sysv/linux/mips/Makefile
	($(objpfx)syscall-%.h): Likewise.
cvs/fedora-2_3-branch
Roland McGrath 23 years ago
parent
commit
7cd72ad380
  1. 33
      Makerules
  2. 11
      mach/Makefile
  3. 26
      sysdeps/unix/sysv/linux/Makefile
  4. 15
      sysdeps/unix/sysv/linux/mips/Makefile

33
Makerules

@ -166,7 +166,7 @@ $(common-objpfx)%.make: $(..)%.make.c $(..)Makerules $(common-before-compile)
rm -f $@T $@.dT rm -f $@T $@.dT
(echo '# Generated from $*.make.c by Makerules.'; \ (echo '# Generated from $*.make.c by Makerules.'; \
$(CC) $(CFLAGS) $(CPPFLAGS) -E $< \ $(CC) $(CFLAGS) $(CPPFLAGS) -E $< \
-MD -MT '$$(common-objpfx)$*.make' -MF $@.dT \ -MD -MP -MT '$$(common-objpfx)$*.make' -MF $@.dT \
| sed -n '/@@@/{s/@@@[ ]*\(.*\)@@@/\1/;s/[ ]*$$//p;}'; \ | sed -n '/@@@/{s/@@@[ ]*\(.*\)@@@/\1/;s/[ ]*$$//p;}'; \
echo 'common-generated += $(@F)'; \ echo 'common-generated += $(@F)'; \
sed $(sed-remove-objpfx) $(sed-remove-dotdot) $@.dT; \ sed $(sed-remove-objpfx) $(sed-remove-dotdot) $@.dT; \
@ -175,9 +175,11 @@ $(common-objpfx)%.make: $(..)%.make.c $(..)Makerules $(common-before-compile)
endif endif
ifdef subdir ifdef subdir
sed-remove-dotdot := -e 's@ *\.\.\/\([^ \]*\)@ $$(..)\1@g' sed-remove-dotdot := -e 's@ *\.\.\/\([^ \]*\)@ $$(..)\1@g' \
-e 's@^\.\.\/\([^ \]*\)@$$(..)\1@g'
else else
sed-remove-dotdot := -e 's@ *\([^ \/$$][^ \]*\)@ $$(..)\1@g' sed-remove-dotdot := -e 's@ *\([^ \/$$][^ \]*\)@ $$(..)\1@g' \
-e 's@^\([^ \/$$][^ \]*\)@$$(..)\1@g'
endif endif
@ -188,7 +190,7 @@ $(common-objpfx)%.h $(common-objpfx)%.h.d: $(..)scripts/gen-as-const.awk \
%.sym $(common-before-compile) %.sym $(common-before-compile)
$(AWK) -f $< $(filter %.sym,$^) \ $(AWK) -f $< $(filter %.sym,$^) \
| $(CC) -S -o - $(CFLAGS) $(CPPFLAGS) -x c - \ | $(CC) -S -o - $(CFLAGS) $(CPPFLAGS) -x c - \
-MD -MF $(@:.h=.h.d)T -MT '$(@:.h=.h.d) $(@:.h.d=.h)' \ -MD -MP -MF $(@:.h=.h.d)T -MT '$(@:.h=.h.d) $(@:.h.d=.h)' \
| sed -n 's/^.*@@@name@@@\([^@]*\)@@@value@@@[^0-9Xxa-fA-F-]*\([0-9Xxa-fA-F-][0-9Xxa-fA-F-]*\).*@@@end@@@.*$$/#define \1 \2/p' > $(@:.h.d=.h)T | sed -n 's/^.*@@@name@@@\([^@]*\)@@@value@@@[^0-9Xxa-fA-F-]*\([0-9Xxa-fA-F-][0-9Xxa-fA-F-]*\).*@@@end@@@.*$$/#define \1 \2/p' > $(@:.h.d=.h)T
sed $(sed-remove-objpfx) $(sed-remove-dotdot) \ sed $(sed-remove-objpfx) $(sed-remove-dotdot) \
$(@:.h=.h.d)T > $(@:.h=.h.d)T2 $(@:.h=.h.d)T > $(@:.h=.h.d)T2
@ -1232,7 +1234,6 @@ endif
endif endif
# There's no good place to put this - here will do. # There's no good place to put this - here will do.
# The dependencies are wrong if it's run from the top level.
ifeq ($(filter %posix, $(sysdirs)),) ifeq ($(filter %posix, $(sysdirs)),)
L_tmpnam = 1 L_tmpnam = 1
TMP_MAX = 0 TMP_MAX = 0
@ -1250,24 +1251,20 @@ $(stdio_lim:lim.h=%.h) $(stdio_lim:lim.h=%.d): $(stdio_lim:lim.h=%.st); @:
$(stdio_lim:h=st): $(..)stdio-common/stdio_lim.h.in $(..)Rules \ $(stdio_lim:h=st): $(..)stdio-common/stdio_lim.h.in $(..)Rules \
$(common-objpfx)config.make $(common-objpfx)config.make
$(make-target-directory) $(make-target-directory)
echo '#include "$(..)posix/bits/posix1_lim.h"' | \ { echo '#include "$(..)posix/bits/posix1_lim.h"'; \
SUNPRO_DEPENDENCIES='$(@:st=dT) $@' \ echo '#define _LIBC 1'; \
$(CC) $(+includes) -E -dM -xc - -o $(@:st=hT) echo '#include "$(..)misc/sys/uio.h"'; } | \
echo '#include "$(..)misc/sys/uio.h"' | \ $(CC) -E -dM -MD -MP -MF $(@:st=dT) -MT '$(@:st=h) $(@:st=d)' \
SUNPRO_DEPENDENCIES='$(@:st=dT) $@' \ $(+includes) -xc - -o $(@:st=hT)
$(CC) -D_LIBC=1 $(+includes) -E -dM -xc - | cat - >> $(@:st=hT) sed $(sed-remove-objpfx) $(sed-remove-dotdot) \
ifdef sed-remove-objpfx $(@:st=dT) > $(@:st=dt)
sed $(sed-remove-objpfx) $(@:st=dT) > $(@:st=dt) mv -f $(@:st=dt) $(@:st=d)
cat $(@:st=dt) >> $(@:st=d)
else
cat $(@:st=dT) >> $(@:st=d)
endif
fopen_max=`sed -n 's/^#define OPEN_MAX //1p' $(@:st=hT)`; \ fopen_max=`sed -n 's/^#define OPEN_MAX //1p' $(@:st=hT)`; \
filename_max=`sed -n 's/^#define PATH_MAX //1p' $(@:st=hT)`; \ filename_max=`sed -n 's/^#define PATH_MAX //1p' $(@:st=hT)`; \
iov_max=`sed -n 's/^#define UIO_MAXIOV //p' $(@:st=hT)`; \ iov_max=`sed -n 's/^#define UIO_MAXIOV //p' $(@:st=hT)`; \
fopen_max=$${fopen_max:-16}; \ fopen_max=$${fopen_max:-16}; \
filename_max=$${filename_max:-1024}; \ filename_max=$${filename_max:-1024}; \
if [ -z $$iov_max ]; then \ if [ -z "$$iov_max" ]; then \
define_iov_max="# undef IOV_MAX"; \ define_iov_max="# undef IOV_MAX"; \
else \ else \
define_iov_max="# define IOV_MAX $$iov_max"; \ define_iov_max="# define IOV_MAX $$iov_max"; \

11
mach/Makefile

@ -79,12 +79,17 @@ $(objpfx)mach-syscalls.mk: syscalls.awk Makefile
$(make-target-directory) $(make-target-directory)
# We must use $(CFLAGS) to get -O flags that affect #if's in header files. # We must use $(CFLAGS) to get -O flags that affect #if's in header files.
echo '#include <mach/syscall_sw.h>' | \ echo '#include <mach/syscall_sw.h>' | \
DEPENDENCIES_OUTPUT='$@-dep $@' \ $(CC) $(CFLAGS) $(CPPFLAGS) -E -MD -MP -MF $@-dep -MT $@ \
$(CC) $(CFLAGS) $(CPPFLAGS) -E -x c-header - \ -x c-header - \
-D_MACH_`echo $(mach-machine) | tr a-z A-Z`_SYSCALL_SW_H_=1 | \ -D_MACH_`echo $(mach-machine) | tr a-z A-Z`_SYSCALL_SW_H_=1 | \
sed -n -e 's/^kernel_trap(\(.*\),\([-0-9]*\),\([0-9]*\))$$/\1 \2 \3/p'\ sed -n -e 's/^kernel_trap(\(.*\),\([-0-9]*\),\([0-9]*\))$$/\1 \2 \3/p'\
| $(AWK) -f $< > $@-new | $(AWK) -f $< > $@-new
cat $@-dep >> $@-new; rm -f $@-dep ifneq (,$(objpfx))
sed $(sed-remove-objpfx) $@-dep >> $@-new
else
cat $@-dep >> $@-new
endif
rm -f $@-dep
mv -f $@-new $@ mv -f $@-new $@
generated += mach-syscalls.mk generated += mach-syscalls.mk

26
sysdeps/unix/sysv/linux/Makefile

@ -30,7 +30,6 @@ install-others += $(inst_includedir)/bits/syscall.h
# we generate a file that uses <bits/wordsize.h>. # we generate a file that uses <bits/wordsize.h>.
$(objpfx)syscall-%.h $(objpfx)syscall-%.d: ../sysdeps/unix/sysv/linux/sys/syscall.h $(objpfx)syscall-%.h $(objpfx)syscall-%.d: ../sysdeps/unix/sysv/linux/sys/syscall.h
$(make-target-directory) $(make-target-directory)
rm -f $(@:.h=.d)-t
{ \ { \
echo '/* Generated at libc build time from kernel syscall list. */';\ echo '/* Generated at libc build time from kernel syscall list. */';\
echo ''; \ echo ''; \
@ -38,14 +37,14 @@ $(objpfx)syscall-%.h $(objpfx)syscall-%.d: ../sysdeps/unix/sysv/linux/sys/syscal
echo '# error "Never use <bits/syscall.h> directly; include <sys/syscall.h> instead."'; \ echo '# error "Never use <bits/syscall.h> directly; include <sys/syscall.h> instead."'; \
echo '#endif'; \ echo '#endif'; \
echo ''; \ echo ''; \
SUNPRO_DEPENDENCIES='$(@:.h=.d)-t $@' \ $(CC) -E -MD -MP -MF $(@:.h=.d)-t1 -MT '$(@:.d=.h) $(@:.h=.d)' \
$(CC) -E -x c $(sysincludes) $< $(addprefix -U,$(64bit-predefine)) \ -x c $(sysincludes) $< $(addprefix -U,$(64bit-predefine)) \
$(addprefix -D,$(32bit-predefine)) -D_LIBC -dM | \ $(addprefix -D,$(32bit-predefine)) -D_LIBC -dM | \
sed -n 's@^#define __NR_\([^ ]*\) .*$$@#define SYS_\1 __NR_\1@p' | \ sed -n 's@^#define __NR_\([^ ]*\) .*$$@#define SYS_\1 __NR_\1@p' | \
LC_ALL=C sort > $(@:.d=.h).new32; \ LC_ALL=C sort > $(@:.d=.h).new32; \
SUNPRO_DEPENDENCIES='$(@:.h=.d)-t $@' \ $(CC) -E -MD -MP -MF $(@:.h=.d)-t2 -MT '$(@:.d=.h) $(@:.h=.d)' \
$(CC) -E -x c $(sysincludes) $< $(addprefix -U,$(32bit-predefine)) \ -x c $(sysincludes) $< $(addprefix -U,$(32bit-predefine)) \
$(addprefix -D,$(64bit-predefine)) -D_LIBC -dM | \ $(addprefix -D,$(64bit-predefine)) -D_LIBC -dM | \
sed -n 's@^#define __NR_\([^ ]*\) .*$$@#define SYS_\1 __NR_\1@p' | \ sed -n 's@^#define __NR_\([^ ]*\) .*$$@#define SYS_\1 __NR_\1@p' | \
LC_ALL=C sort > $(@:.d=.h).new64; \ LC_ALL=C sort > $(@:.d=.h).new64; \
if cmp -s $(@:.d=.h).new32 $(@:.d=.h).new64; then \ if cmp -s $(@:.d=.h).new32 $(@:.d=.h).new64; then \
@ -63,12 +62,13 @@ $(objpfx)syscall-%.h $(objpfx)syscall-%.d: ../sysdeps/unix/sysv/linux/sys/syscal
rm -f $(@:.d=.h).new32 $(@:.d=.h).new64; \ rm -f $(@:.d=.h).new32 $(@:.d=.h).new64; \
} > $(@:.d=.h).new } > $(@:.d=.h).new
mv -f $(@:.d=.h).new $(@:.d=.h) mv -f $(@:.d=.h).new $(@:.d=.h)
sed < $(@:.h=.d)-t > $(@:.h=.d)-t2 \ ifneq (,$(objpfx))
-e 's,$(subst .,\.,$@),$(patsubst $(objpfx)%,$$(objpfx)%,\ sed $(sed-remove-objpfx) $(@:.h=.d)-t1 $(@:.h=.d)-t2 > $(@:.h=.d)-t3
$(@:.d=.h) $(@:.h=.d)),' else
rm -f $(@:.h=.d)-t cat $(@:.h=.d)-t1 $(@:.h=.d)-t2 > $(@:.h=.d)-t3
mv -f $(@:.h=.d)-t2 $(@:.h=.d) endif
rm -f $(@:.h=.d)-t1 $(@:.h=.d)-t2
mv -f $(@:.h=.d)-t3 $(@:.h=.d)
$(inst_includedir)/bits/syscall.h: $(objpfx)syscall-list.h $(+force) $(inst_includedir)/bits/syscall.h: $(objpfx)syscall-list.h $(+force)
$(make-target-directory) $(make-target-directory)

15
sysdeps/unix/sysv/linux/mips/Makefile

@ -15,7 +15,6 @@ no_syscall_list_h = 1
# We generate not only SYS_<syscall>, pointing at SYS_<abi>_<syscall> if # We generate not only SYS_<syscall>, pointing at SYS_<abi>_<syscall> if
# it exists, but also define SYS_<abi>_<syscall> for all ABIs. # it exists, but also define SYS_<abi>_<syscall> for all ABIs.
$(objpfx)syscall-%.h $(objpfx)syscall-%.d: ../sysdeps/unix/sysv/linux/mips/sys/syscall.h $(objpfx)syscall-%.h $(objpfx)syscall-%.d: ../sysdeps/unix/sysv/linux/mips/sys/syscall.h
rm -f $(@:.h=.d)-t
{ \ { \
echo '/* Generated at libc build time from kernel syscall list. */';\ echo '/* Generated at libc build time from kernel syscall list. */';\
echo ''; \ echo ''; \
@ -24,9 +23,10 @@ $(objpfx)syscall-%.h $(objpfx)syscall-%.d: ../sysdeps/unix/sysv/linux/mips/sys/s
echo '#endif'; \ echo '#endif'; \
echo ''; \ echo ''; \
rm -f $(@:.d=.h).newt; \ rm -f $(@:.d=.h).newt; \
SUNPRO_DEPENDENCIES='$(@:.h=.d)-t $@' \ $(CC) -E -MD -MP -MF $(@:.h=.d)-t -MT '$(@:.d=.h) $(@:.h=.d)' \
$(CC) -E -x c -I $(common-objdir) $(sysincludes) $< -D_LIBC -dM | \ -x c -I $(common-objdir) $(sysincludes) $< -D_LIBC -dM | \
sed -n 's@^#define __NR_\([^ ]*\) .*$$@#define SYS_\1 __NR_\1@p' > $(@:.d=.h).newt; \ sed -n 's@^#define __NR_\([^ ]*\) .*$$@#define SYS_\1 __NR_\1@p' \
> $(@:.d=.h).newt; \
if grep SYS_O32_ $(@:.d=.h).newt > /dev/null; then \ if grep SYS_O32_ $(@:.d=.h).newt > /dev/null; then \
echo '#if defined _ABI64 && _MIPS_SIM == _ABI64'; \ echo '#if defined _ABI64 && _MIPS_SIM == _ABI64'; \
sed -n 's/^\(#define SYS_\)N64_/\1/p' < $(@:.d=.h).newt; \ sed -n 's/^\(#define SYS_\)N64_/\1/p' < $(@:.d=.h).newt; \
@ -42,9 +42,10 @@ $(objpfx)syscall-%.h $(objpfx)syscall-%.d: ../sysdeps/unix/sysv/linux/mips/sys/s
rm $(@:.d=.h).newt; \ rm $(@:.d=.h).newt; \
} > $(@:.d=.h).new } > $(@:.d=.h).new
mv -f $(@:.d=.h).new $(@:.d=.h) mv -f $(@:.d=.h).new $(@:.d=.h)
sed < $(@:.h=.d)-t > $(@:.h=.d)-t2 \ ifneq (,$(objpfx))
-e 's,$(subst .,\.,$@),$(patsubst $(objpfx)%,$$(objpfx)%,\ sed $(sed-remove-objpfx) $(@:.h=.d)-t > $(@:.h=.d)-t2
$(@:.d=.h) $(@:.h=.d)),'
rm -f $(@:.h=.d)-t rm -f $(@:.h=.d)-t
mv -f $(@:.h=.d)-t2 $(@:.h=.d) mv -f $(@:.h=.d)-t2 $(@:.h=.d)
else
mv -f $(@:.h=.d)-t $(@:.h=.d)
endif endif

Loading…
Cancel
Save