xmkmf.cpp 977 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. XCOMM!/bin/sh
  2. XCOMM
  3. XCOMM generate a Makefile from an Imakefile from inside or outside the sources
  4. XCOMM
  5. XCOMM $XConsortium: xmkmf.cpp,v 1.18 91/08/22 11:08:01 rws Exp $
  6. usage="usage: $0 [-a] [top_of_sources_pathname [current_directory]]"
  7. topdir=
  8. curdir=.
  9. do_all=
  10. case "$1" in
  11. -a)
  12. do_all="yes"
  13. shift
  14. ;;
  15. esac
  16. case $# in
  17. 0) ;;
  18. 1) topdir=$1 ;;
  19. 2) topdir=$1 curdir=$2 ;;
  20. *) echo "$usage" 1>&2; exit 1 ;;
  21. esac
  22. case "$topdir" in
  23. -*) echo "$usage" 1>&2; exit 1 ;;
  24. esac
  25. if [ -f Makefile ]; then
  26. echo mv Makefile Makefile.bak
  27. mv Makefile Makefile.bak
  28. fi
  29. if [ "$topdir" = "" ]; then
  30. args="-DUseInstalled "CONFIGDIRSPEC
  31. else
  32. args="-I$topdir/config -DTOPDIR=$topdir -DCURDIR=$curdir"
  33. fi
  34. echo imake $args
  35. case "$do_all" in
  36. yes)
  37. imake $args &&
  38. echo "make Makefiles" &&
  39. make Makefiles &&
  40. echo "make includes" &&
  41. make includes &&
  42. echo "make depend" &&
  43. make depend
  44. ;;
  45. *)
  46. imake $args
  47. ;;
  48. esac