Added mkinstalldirs to create directories more portably.

This commit is contained in:
Alexandre Julliard 2002-05-09 04:31:39 +00:00
parent da580c47ff
commit ce830a9c18
21 changed files with 151 additions and 45 deletions

View File

@ -51,7 +51,6 @@ LDFLAGS = @LDFLAGS@
AR = ar rc
RM = rm -f
MV = mv
MKDIR = mkdir -p
C2MAN = @C2MAN@
MANSPECS = -w $(TOPSRCDIR)/dlls/gdi/gdi32.spec \
-w $(TOPSRCDIR)/dlls/user/user32.spec \
@ -61,6 +60,7 @@ MANSPECS = -w $(TOPSRCDIR)/dlls/gdi/gdi32.spec \
LINT = @LINT@
LINTFLAGS = @LINTFLAGS@
ALLLINTFLAGS = $(LINTFLAGS) $(DEFS) $(OPTIONS) $(DIVINCL)
MKINSTALLDIRS= $(TOPSRCDIR)/tools/mkinstalldirs
WINAPI_CHECK = $(TOPSRCDIR)/tools/winapi_check/winapi_check
WINEBUILD = $(TOPOBJDIR)/tools/winebuild/winebuild
MAKEDEP = $(TOPOBJDIR)/tools/makedep
@ -198,13 +198,13 @@ $(SUBDIRS:%=%/__man__): dummy
cd `dirname $@` && $(MAKE) man
man: $(C_SRCS) $(SUBDIRS:%=%/__man__)
if [ -n "$(C_SRCS)" ]; then $(MKDIR) $(TOPOBJDIR)/documentation/man3w; for i in $(C_SRCS); do $(C2MAN) -L -o $(TOPOBJDIR)/documentation/man3w -S3w $(DIVINCL) -D__WINE__ $(MANSPECS) $$i; done; fi
if [ -n "$(C_SRCS)" ]; then $(MKINSTALLDIRS) $(TOPOBJDIR)/documentation/man3w; for i in $(C_SRCS); do $(C2MAN) -L -o $(TOPOBJDIR)/documentation/man3w -S3w $(DIVINCL) -D__WINE__ $(MANSPECS) $$i; done; fi
$(SUBDIRS:%=%/__doc_html__): dummy
cd `dirname $@` && $(MAKE) doc-html
doc-html: $(C_SRCS) $(SUBDIRS:%=%/__doc_html__)
if [ -n "$(C_SRCS)" ]; then $(MKDIR) $(TOPOBJDIR)/documentation/html; for i in $(C_SRCS); do $(C2MAN) -L -o $(TOPOBJDIR)/documentation/html -Th -iwindows.h $(DIVINCL) -D__WINE__ $(MANSPECS) $$i; done; fi
if [ -n "$(C_SRCS)" ]; then $(MKINSTALLDIRS) $(TOPOBJDIR)/documentation/html; for i in $(C_SRCS); do $(C2MAN) -L -o $(TOPOBJDIR)/documentation/html -Th -iwindows.h $(DIVINCL) -D__WINE__ $(MANSPECS) $$i; done; fi
# Rule for linting

View File

@ -93,14 +93,14 @@ wine: $(EMUOBJS) $(LDIMPORTS:%=lib%.$(LIBEXT)) library/libwine.$(LIBEXT) unicode
$(CC) -o wine $(EMUOBJS) -L. $(LDIMPORTS:%=-l%) $(LIBWINE) $(LIBUNICODE) $(LIBS) $(LDFLAGS)
install_wine: dummy
[ -d $(bindir) ] || $(MKDIR) $(bindir)
$(MKINSTALLDIRS) $(bindir)
$(INSTALL_PROGRAM) wine $(bindir)/wine
install:: all install_wine $(INSTALLSUBDIRS:%=%/__install__)
-$(LDCONFIG)
uninstall:: $(INSTALLSUBDIRS:%=%/__uninstall__)
cd $(bindir) && $(RM) wine
$(RM) $(bindir)/wine
$(EMUOBJS) $(PROGRAMS) $(LIBRARIES): dummy
@cd `dirname $@` && $(MAKE) `basename $@`
@ -163,11 +163,11 @@ TAGS etags:
etags `find $(TOPSRCDIR) -name '*.[chS]' -print | grep -v dbgmain`
manpages:
-$(MKDIR) $(TOPOBJDIR)/documentation/man3w
$(MKINSTALLDIRS) $(TOPOBJDIR)/documentation/man3w
for i in $(SUBDIRS); do (cd $$i && $(MAKE) man); done
htmlpages:
-$(MKDIR) $(TOPOBJDIR)/documentation/html
$(MKINSTALLDIRS) $(TOPOBJDIR)/documentation/html
for i in $(SUBDIRS); do (cd $$i && $(MAKE) html); done
clean::

View File

@ -59,7 +59,7 @@ $(ALTNAMES:%=_install_/%$(DLLEXT)): install_lib
cd $(dlldir) && $(RM) `basename $@` && $(LN_S) $(MODULE)$(DLLEXT) `basename $@`
install_lib: $(MODULE)$(DLLEXT)
[ -d $(dlldir) ] || $(MKDIR) $(dlldir)
$(MKINSTALLDIRS) $(dlldir)
$(INSTALL_PROGRAM) $(MODULE)$(DLLEXT) $(dlldir)/$(MODULE)$(DLLEXT)
install:: install_lib $(ALTNAMES:%=_install_/%$(DLLEXT))

View File

@ -42,7 +42,7 @@ $(EXTRA_OBJS): dummy
@cd `dirname $@` && $(MAKE) `basename $@`
install:: $(PROGRAMS) install_libdir
[ -d $(bindir) ] || $(MKDIR) $(bindir)
$(MKINSTALLDIRS) $(bindir)
$(INSTALL_PROGRAM) wineclipsrv $(bindir)/wineclipsrv
uninstall:: uninstall_libdir

View File

@ -205,10 +205,7 @@ EXTRASUBDIRS = bitmaps msvcrt msvcrt/sys wine
@MAKE_RULES@
install::
[ -d $(includedir) ] || $(MKDIR) $(includedir)
[ -d $(includedir)/wine ] || $(MKDIR) $(includedir)/wine
[ -d $(includedir)/msvcrt ] || $(MKDIR) $(includedir)/msvcrt
[ -d $(includedir)/msvcrt/sys ] || $(MKDIR) $(includedir)/msvcrt/sys
$(MKINSTALLDIRS) $(includedir) $(includedir)/wine $(includedir)/msvcrt $(includedir)/msvcrt/sys
for f in $(INSTALLED_INCLUDES); do $(INSTALL_DATA) $(SRCDIR)/$$f $(includedir)/$$f; done
# Don't just do a rm -rf on $(includedir) -- don't want to wipe out

View File

@ -35,18 +35,18 @@ libwine.dll: $(OBJS)
$(DLLWRAP) $(DLLWRAPFLAGS) --export-all --implib libwine.a -o libwine.dll $(OBJS)
install_so: libwine.so.$(SOVERSION)
[ -d $(libdir) ] || $(MKDIR) $(libdir)
$(MKINSTALLDIRS) $(libdir)
$(INSTALL_PROGRAM) libwine.so.$(SOVERSION) $(libdir)/libwine.so.$(SOVERSION)
cd $(libdir) && $(RM) libwine.so && $(LN_S) libwine.so.$(SOVERSION) libwine.so
install_a: libwine.a
[ -d $(libdir) ] || $(MKDIR) $(libdir)
$(MKINSTALLDIRS) $(libdir)
$(INSTALL_DATA) libwine.a $(libdir)/libwine.a
install:: all $(LIBEXT:%=install_%)
uninstall::
cd $(libdir) && $(RM) libwine.a libwine.so libwine.so.$(SOVERSION)
$(RM) $(libdir)/libwine.a $(libdir)/libwine.so $(libdir)/libwine.so.$(SOVERSION)
clean::
$(RM) libwine.so.$(SOVERSION)

View File

@ -22,10 +22,10 @@ libwine_uuid.a: uuid.o
$(RANLIB) $@
install: libwine_uuid.a
[ -d $(libdir) ] || $(MKDIR) $(libdir)
$(MKINSTALLDIRS) $(libdir)
$(INSTALL_DATA) libwine_uuid.a $(libdir)/libwine_uuid.a
uninstall::
cd $(libdir) && $(RM) libwine_uuid.a
$(RM) $(libdir)/libwine_uuid.a
### Dependencies:

View File

@ -44,12 +44,12 @@ debug_channels: dummy
# Rules for installation
install:: $(MODULE).so
[ -d $(bindir) ] || $(MKDIR) $(bindir)
$(MKINSTALLDIRS) $(bindir)
$(INSTALL_PROGRAM) $(MODULE).so $(bindir)/$(MODULE).so
cd $(bindir) && $(RM) $(MODULE) && $(LN_S) wine $(MODULE)
uninstall::
cd $(bindir) && $(RM) $(MODULE) $(MODULE).so
$(RM) $(bindir)/$(MODULE) $(bindir)/$(MODULE).so
clean::
$(RM) $(MODULE)

View File

@ -45,7 +45,7 @@ icinfo: icinfo.so
$(RM) icinfo && $(LN_S) $(TOPOBJDIR)/wine icinfo
install:: $(PROGRAMS:%=%.so)
[ -d $(bindir) ] || $(MKDIR) $(bindir)
$(MKINSTALLDIRS) $(bindir)
$(INSTALL_PROGRAM) aviinfo.so $(bindir)/aviinfo.so
$(INSTALL_PROGRAM) aviplay.so $(bindir)/aviplay.so
$(INSTALL_PROGRAM) icinfo.so $(bindir)/icinfo.so

View File

@ -28,11 +28,11 @@ wine.c: wine.xs
perl $(XSUBPPDIR)/xsubpp -typemap $(XSUBPPDIR)/typemap $(SRCDIR)/wine.xs >wine.c || $(RM) wine.c
install::
[ -d $(libdir) ] || $(MKDIR) $(libdir)
$(MKINSTALLDIRS) $(libdir)
$(INSTALL_DATA) wine.pm $(libdir)/wine.pm
uninstall::
cd $(libdir) && $(RM) wine.pm
$(RM) $(libdir)/wine.pm
clean::
$(RM) wine.c

View File

@ -51,7 +51,7 @@ wineserver: $(OBJS)
$(CC) -o $(PROGRAMS) $(OBJS) $(LIBWINE) $(LIBUNICODE) $(LIBS) $(LDFLAGS)
install:: $(PROGRAMS)
[ -d $(bindir) ] || $(MKDIR) $(bindir)
$(MKINSTALLDIRS) $(bindir)
$(INSTALL_PROGRAM) wineserver $(bindir)/wineserver
uninstall::

View File

@ -44,7 +44,7 @@ winelauncher: winelauncher.in
sed -e 's,@bindir\@,$(bindir),g' -e 's,@libdir\@,$(libdir),g' -e 's,@dlldir\@,$(dlldir),g' $(SRCDIR)/winelauncher.in >$@ || $(RM) $@
install:: $(PROGRAMS) $(INSTALLSUBDIRS:%=%/__install__)
[ -d $(bindir) ] || $(MKDIR) $(bindir)
$(MKINSTALLDIRS) $(bindir)
$(INSTALL_PROGRAM) fnt2bdf $(bindir)/fnt2bdf
$(INSTALL_SCRIPT) winelauncher $(bindir)/winelauncher
$(INSTALL_SCRIPT) $(SRCDIR)/winemaker $(bindir)/winemaker

View File

@ -1,15 +1,27 @@
#! /bin/sh
#!/bin/sh
#
# install - install a program, script, or datafile
# This comes from X11R5.
# This comes from X11R5 (mit/util/scripts/install.sh).
#
# Copyright 1991 by the Massachusetts Institute of Technology
#
# Permission to use, copy, modify, distribute, and sell this software and its
# documentation for any purpose is hereby granted without fee, provided that
# the above copyright notice appear in all copies and that both that
# copyright notice and this permission notice appear in supporting
# documentation, and that the name of M.I.T. not be used in advertising or
# publicity pertaining to distribution of the software without specific,
# written prior permission. M.I.T. makes no representations about the
# suitability of this software for any purpose. It is provided "as is"
# without express or implied warranty.
#
# Calling this script install-sh is preferred over install.sh, to prevent
# `make' implicit rules from creating a file called install from it
# when there is no Makefile.
#
# This script is compatible with the BSD install script, but was written
# from scratch.
#
# from scratch. It can only install one file at a time, a restriction
# shared with many OS's install programs.
# set DOITPROG to echo to test this script
@ -29,7 +41,7 @@ stripprog="${STRIPPROG-strip}"
rmprog="${RMPROG-rm}"
mkdirprog="${MKDIRPROG-mkdir}"
tranformbasename=""
transformbasename=""
transform_arg=""
instcmd="$mvprog"
chmodcmd="$chmodprog 0755"
@ -106,6 +118,7 @@ if [ x"$dir_arg" != x ]; then
if [ -d $dst ]; then
instcmd=:
chmodcmd=""
else
instcmd=mkdir
fi

99
tools/mkinstalldirs Executable file
View File

@ -0,0 +1,99 @@
#! /bin/sh
# mkinstalldirs --- make directory hierarchy
# Author: Noah Friedman <friedman@prep.ai.mit.edu>
# Created: 1993-05-16
# Public domain
errstatus=0
dirmode=""
usage="\
Usage: mkinstalldirs [-h] [--help] [-m mode] dir ..."
# process command line arguments
while test $# -gt 0 ; do
case "${1}" in
-h | --help | --h* ) # -h for help
echo "${usage}" 1>&2; exit 0 ;;
-m ) # -m PERM arg
shift
test $# -eq 0 && { echo "${usage}" 1>&2; exit 1; }
dirmode="${1}"
shift ;;
-- ) shift; break ;; # stop option processing
-* ) echo "${usage}" 1>&2; exit 1 ;; # unknown option
* ) break ;; # first non-opt arg
esac
done
for file
do
if test -d "$file"; then
shift
else
break
fi
done
case $# in
0) exit 0 ;;
esac
case $dirmode in
'')
if mkdir -p -- . 2>/dev/null; then
echo "mkdir -p -- $*"
exec mkdir -p -- "$@"
fi ;;
*)
if mkdir -m "$dirmode" -p -- . 2>/dev/null; then
echo "mkdir -m $dirmode -p -- $*"
exec mkdir -m "$dirmode" -p -- "$@"
fi ;;
esac
for file
do
set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'`
shift
pathcomp=
for d
do
pathcomp="$pathcomp$d"
case "$pathcomp" in
-* ) pathcomp=./$pathcomp ;;
esac
if test ! -d "$pathcomp"; then
echo "mkdir $pathcomp"
mkdir "$pathcomp" || lasterr=$?
if test ! -d "$pathcomp"; then
errstatus=$lasterr
else
if test ! -z "$dirmode"; then
echo "chmod $dirmode $pathcomp"
lasterr=""
chmod "$dirmode" "$pathcomp" || lasterr=$?
if test ! -z "$lasterr"; then
errstatus=$lasterr
fi
fi
fi
fi
pathcomp="$pathcomp/"
done
done
exit $errstatus
# Local Variables:
# mode: shell-script
# sh-indentation: 3
# End:
# mkinstalldirs ends here

View File

@ -12,7 +12,7 @@ all: $(PROGRAMS)
@MAKE_RULES@
install:: $(PROGRAMS)
[ -d $(bindir) ] || $(MKDIR) $(bindir)
$(MKINSTALLDIRS) $(bindir)
$(INSTALL_SCRIPT) $(SRCDIR)/trampoline $(bindir)/make_filter
$(INSTALL_SCRIPT) $(SRCDIR)/trampoline $(bindir)/winapi_check
$(INSTALL_SCRIPT) $(SRCDIR)/trampoline $(bindir)/winapi_extract

View File

@ -26,7 +26,7 @@ winebuild: $(OBJS)
$(CC) $(CFLAGS) -o winebuild $(OBJS) $(LIBWINE) $(LIBUNICODE) $(LDFLAGS)
install:: $(PROGRAMS)
[ -d $(bindir) ] || $(MKDIR) $(bindir)
$(MKINSTALLDIRS) $(bindir)
$(INSTALL_PROGRAM) winebuild $(bindir)/winebuild
uninstall::

View File

@ -25,12 +25,11 @@ winedump: $(OBJS)
$(CC) $(CFLAGS) -o winedump $(OBJS) $(LIBWINE) $(LDFLAGS)
install:: $(PROGRAMS)
[ -d $(bindir) ] || $(MKDIR) $(bindir)
$(MKINSTALLDIRS) $(bindir)
$(INSTALL_PROGRAM) winedump $(bindir)/winedump
$(INSTALL_SCRIPT) $(SRCDIR)/function_grep.pl $(bindir)/function_grep.pl
uninstall::
$(RM) $(bindir)/winedump
$(RM) $(bindir)/function_grep.pl
$(RM) $(bindir)/function_grep.pl $(bindir)/winedump
### Dependencies:

View File

@ -34,8 +34,7 @@ clean::
$(RM) y.tab.c y.tab.h y.output
install:: $(PROGRAMS)
[ -d $(bindir) ] || $(MKDIR) $(bindir)
[ -d $(mandir)/man$(prog_manext) ] || $(MKDIR) $(mandir)/man$(prog_manext)
$(MKINSTALLDIRS) $(bindir) $(mandir)/man$(prog_manext)
$(INSTALL_DATA) $(SRCDIR)/wmc.man $(mandir)/man$(prog_manext)/wmc.$(prog_manext)
$(INSTALL_PROGRAM) wmc $(bindir)/wmc

View File

@ -46,8 +46,7 @@ clean::
$(RM) ppy.tab.h ppy.output parser.output parser.tab.h lex.backup y.output
install:: $(PROGRAMS)
[ -d $(bindir) ] || $(MKDIR) $(bindir)
[ -d $(mandir)/man$(prog_manext) ] || $(MKDIR) $(mandir)/man$(prog_manext)
$(MKINSTALLDIRS) $(bindir) $(mandir)/man$(prog_manext)
$(INSTALL_DATA) $(SRCDIR)/wrc.man $(mandir)/man$(prog_manext)/wrc.$(prog_manext)
$(INSTALL_PROGRAM) wrc $(bindir)/wrc

View File

@ -40,18 +40,18 @@ libwine_tsx11.dll: $(OBJS)
$(DLLWRAP) $(DLLWRAPFLAGS) --export-all --implib libwine_tsx11.a -o libwine_tsx11.dll $(OBJS)
install_so: libwine_tsx11.so.$(SOVERSION)
[ -d $(libdir) ] || $(MKDIR) $(libdir)
$(MKINSTALLDIRS) $(libdir)
$(INSTALL_PROGRAM) libwine_tsx11.so.$(SOVERSION) $(libdir)/libwine_tsx11.so.$(SOVERSION)
cd $(libdir) && $(RM) libwine_tsx11.so && $(LN_S) libwine_tsx11.so.$(SOVERSION) libwine_tsx11.so
install_a: libwine_tsx11.a
[ -d $(libdir) ] || $(MKDIR) $(libdir)
$(MKINSTALLDIRS) $(libdir)
$(INSTALL_DATA) libwine_tsx11.a $(libdir)/libwine_tsx11.a
install:: all $(LIBEXT:%=install_%)
uninstall::
cd $(libdir) && $(RM) libwine_tsx11.a libwine_tsx11.so libwine_tsx11.so.$(SOVERSION)
$(RM) $(libdir)/libwine_tsx11.a $(libdir)/libwine_tsx11.so $(libdir)/libwine_tsx11.so.$(SOVERSION)
clean::
$(RM) libwine_tsx11.so.$(SOVERSION)

View File

@ -100,18 +100,18 @@ libwine_unicode.dll: $(OBJS) wine_unicode.def
$(DLLWRAP) $(DLLWRAPFLAGS) --def wine_unicode.def --implib libwine_unicode.a -o libwine_unicode.dll $(OBJS)
install_so: libwine_unicode.so.$(SOVERSION)
[ -d $(libdir) ] || $(MKDIR) $(libdir)
$(MKINSTALLDIRS) $(libdir)
$(INSTALL_PROGRAM) libwine_unicode.so.$(SOVERSION) $(libdir)/libwine_unicode.so.$(SOVERSION)
cd $(libdir) && $(RM) libwine_unicode.so && $(LN_S) libwine_unicode.so.$(SOVERSION) libwine_unicode.so
install_a: libwine_unicode.a
[ -d $(libdir) ] || $(MKDIR) $(libdir)
$(MKINSTALLDIRS) $(libdir)
$(INSTALL_DATA) libwine_unicode.a $(libdir)/libwine_unicode.a
install:: all $(LIBEXT:%=install_%)
uninstall::
cd $(libdir) && $(RM) libwine_unicode.a libwine_unicode.so libwine_unicode.so.$(SOVERSION)
$(RM) $(libdir)/libwine_unicode.a $(libdir)/libwine_unicode.so $(libdir)/libwine_unicode.so.$(SOVERSION)
clean::
$(RM) libwine_unicode.so.$(SOVERSION)