Makefile.in
author "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Sun Dec 28 10:19:50 2008 +0000 (2008-12-28)
changeset 1109 a1dc8836fcf4
parent 1101 29ebc048d33f
child 1141 60cda89df6cf
permissions -rw-r--r--
Small Makefile fixes.

/trunk/Makefile.in | 29 17 12 0 +++++++++++++++++------------
1 file changed, 17 insertions(+), 12 deletions(-)
     1 # Makefile.in for building crosstool-NG
     2 # This file serves as source for the ./configure operation
     3 
     4 MAKEFLAGS += --no-print-directory --no-builtin-rules
     5 
     6 all: Makefile build
     7 
     8 ###############################################################################
     9 # Configuration variables
    10 
    11 VERSION:= @@VERSION@@
    12 BINDIR := @@BINDIR@@
    13 LIBDIR := @@LIBDIR@@
    14 DOCDIR := @@DOCDIR@@
    15 MANDIR := @@MANDIR@@
    16 DATE   := @@DATE@@
    17 LOCAL  := @@LOCAL@@
    18 MAKE   := $(shell which $(MAKE) 2>/dev/null || type -p $(MAKE) 2>/dev/null || echo "ct-ng:nomake")
    19 
    20 ###############################################################################
    21 # Sanity checks
    22 
    23 # Check if Makefile is up to date:
    24 Makefile: Makefile.in
    25 	@echo "$< did changed: you must re-run './configure'"
    26 	@false
    27 
    28 # Check we do have make
    29 ifeq ($(strip $(MAKE)),ct-ng:nomake)
    30   $(error 'make' was not found on your system)
    31 endif
    32 
    33 # If installing with DESTDIR, check it's an absolute path
    34 ifneq ($(strip $(DESTDIR)),)
    35   ifneq ($(DESTDIR),$(abspath /$(DESTDIR)))
    36     $(error DESTDIR is not an absolute PATH: '$(DESTDIR)')
    37   endif
    38 endif
    39 
    40 ###############################################################################
    41 # Global make rules
    42 
    43 TARGETS := bin lib doc man
    44 
    45 build: $(patsubst %,build-%,$(TARGETS))
    46 
    47 install: build real-install
    48 
    49 clean: $(patsubst %,clean-%,$(TARGETS))
    50 
    51 distclean: clean
    52 	@echo "  RM     'Makefile'"
    53 	@rm -f Makefile
    54 
    55 uninstall: real-uninstall
    56 
    57 ###############################################################################
    58 # Specific make rules
    59 
    60 #--------------------------------------
    61 # Build rules
    62 
    63 build-bin: ct-ng
    64 
    65 build-lib:
    66 
    67 build-doc:
    68 
    69 build-man: docs/ct-ng.1.gz
    70 
    71 docs/ct-ng.1.gz: docs/ct-ng.1
    72 	@echo "  GZIP   '$@'"
    73 	@gzip -c9 $< >$@
    74 
    75 %: %.in Makefile
    76 	@echo "  SED    '$@'"
    77 	@sed -r -e 's,@@CT_MAKE@@,$(MAKE),g;'       \
    78 	        -e 's,@@CT_BINDIR@@,$(BINDIR),g;'   \
    79 	        -e 's,@@CT_LIBDIR@@,$(LIBDIR),g;'   \
    80 	        -e 's,@@CT_DOCDIR@@,$(DOCDIR),g;'   \
    81 	        -e 's,@@CT_MANDIR@@,$(MANDIR),g;'   \
    82 	        -e 's,@@CT_VERSION@@,$(VERSION),g;'	\
    83 	        -e 's,@@CT_DATE@@,$(DATE),g;'       \
    84 	     $@.in >$@
    85 
    86 #--------------------------------------
    87 # Clean rules
    88 
    89 clean-bin:
    90 	@echo "  RM     'ct-ng'"
    91 	@rm -f ct-ng
    92 
    93 clean-lib:
    94 
    95 clean-doc:
    96 
    97 clean-man:
    98 	@echo "  RM     'docs/ct-ng.1'"
    99 	@rm -f docs/ct-ng.1
   100 	@echo "  RM     'docs/ct-ng.1.gz'"
   101 	@rm -f docs/ct-ng.1.gz
   102 
   103 #--------------------------------------
   104 # Check for --local setup
   105 
   106 ifeq ($(strip $(LOCAL)),1)
   107 
   108 real-install:
   109 	@echo "  CHMOD  'ct-ng'"
   110 	@chmod a+x ct-ng
   111 
   112 real-uninstall:
   113 	@true
   114 
   115 else
   116 
   117 #--------------------------------------
   118 # Install rules
   119 
   120 real-install: $(patsubst %,install-%,$(TARGETS))
   121 
   122 install-bin: $(DESTDIR)$(BINDIR)
   123 	@echo "  INST   'ct-ng'"
   124 	@install -m 755 ct-ng "$(DESTDIR)$(BINDIR)/ct-ng"
   125 
   126 # If one is hacking crosstool-NG, the patch set might change between any two
   127 # installations of the same VERSION, thus the patches must be removed prior
   128 # to being installed. It is simpler to remove the whole lib/ directory, as it
   129 # is the goal of the install-lib rule to install the lib/ directory...
   130 install-lib: uninstall-lib $(DESTDIR)$(LIBDIR) install-lib-main install-lib-samples
   131 
   132 install-lib-main: $(DESTDIR)$(LIBDIR)
   133 	@for src_dir in config kconfig patches scripts; do                              \
   134 	     echo "  INST   '$${src_dir}/'";                                            \
   135 	     tar cf - --exclude=.svn $${src_dir} |(cd "$(DESTDIR)$(LIBDIR)"; tar xf -); \
   136 	 done
   137 	@rm -f "$(DESTDIR)$(LIBDIR)/scripts/addToolVersion.sh"
   138 	@echo "  INST   'steps.mk'"
   139 	@install -m 644 steps.mk "$(DESTDIR)$(LIBDIR)/steps.mk"
   140 
   141 # Samples need a little love:
   142 #  - change every occurrence of CT_TOP_DIR to CT_LIB_DIR
   143 install-lib-samples: $(DESTDIR)$(LIBDIR) install-lib-main
   144 	@echo "  INST   'samples/'"
   145 	@tar cf - --exclude=.svn samples |(cd "$(DESTDIR)$(LIBDIR)"; tar xf -)
   146 	@for samp_file in "$(DESTDIR)$(LIBDIR)/samples/"*"/crosstool.config"; do                \
   147 	     sed -r -i -e 's,\$$\{CT_TOP_DIR\},\$$\{CT_LIB_DIR\},g;' $${samp_file};             \
   148 	     sed -r -i -e 's,^(CT_WORK_DIR)=.*,\1="\$${CT_TOP_DIR}/targets",;' $${samp_file};   \
   149 	 done
   150 
   151 install-doc: $(DESTDIR)$(DOCDIR)
   152 	@for doc_file in docs/CREDITS docs/overview.txt; do         \
   153 	     echo "  INST   '$${doc_file}'";                        \
   154 	     install -m 644 "$${doc_file}" "$(DESTDIR)$(DOCDIR)";   \
   155 	 done
   156 
   157 install-man: $(DESTDIR)$(MANDIR)
   158 	@echo "  INST   'ct-ng.1.gz'"
   159 	@install -m 644 docs/ct-ng.1.gz "$(DESTDIR)$(MANDIR)"
   160 
   161 $(sort $(DESTDIR)$(BINDIR) $(DESTDIR)$(LIBDIR) $(DESTDIR)$(DOCDIR) $(DESTDIR)$(MANDIR)):
   162 	@echo "  MKDIR  '$@'"
   163 	@install -m 755 -d "$@"
   164 
   165 
   166 #--------------------------------------
   167 # Uninstall rules
   168 
   169 real-uninstall: $(patsubst %,uninstall-%,$(TARGETS))
   170 
   171 uninstall-bin:
   172 	@echo "  RM     '$(DESTDIR)$(BINDIR)/ct-ng'"
   173 	@rm -f "$(DESTDIR)$(BINDIR)/ct-ng"
   174 
   175 uninstall-lib:
   176 	@echo "  RMDIR  '$(DESTDIR)$(LIBDIR)/'"
   177 	@rm -rf "$(DESTDIR)$(LIBDIR)"
   178 
   179 uninstall-doc:
   180 	@echo "  RMDIR  '$(DESTDIR)$(DOCDIR)/'"
   181 	@rm -rf "$(DESTDIR)$(DOCDIR)"
   182 
   183 uninstall-man:
   184 	@echo "  RM     '$(DESTDIR)$(MANDIR)/ct-ng.1.gz'"
   185 	@rm -f "$(DESTDIR)$(MANDIR)/ct-ng.1"{,.gz}
   186 
   187 endif # Not --local