Makefile.in
author "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Fri Aug 31 16:20:03 2007 +0000 (2007-08-31)
changeset 348 9fcb5046b4b5
parent 318 f584c33de0ba
child 380 2f7b676c7b2f
permissions -rw-r--r--
Trying to guess how we were called does not work. Don't try to be smart, and take the full path, even if we are in PATH.
     1 # Makefile.in for building crosstool-NG
     2 # This file serves as source for the ./configure operation
     3 
     4 all: build
     5 
     6 ###############################################################################
     7 # Configuration variables
     8 
     9 VERSION:= @@VERSION@@
    10 BINDIR := @@BINDIR@@
    11 LIBDIR := @@LIBDIR@@
    12 DOCDIR := @@DOCDIR@@
    13 MANDIR := @@MANDIR@@
    14 DATE   := @@DATE@@
    15 LOCAL  := @@LOCAL@@
    16 MAKE   := $(shell which $(MAKE) || type -p $(MAKE) || echo /usr/bin/make)
    17 
    18 ###############################################################################
    19 # Global make rules
    20 
    21 build: build-bin build-lib build-man
    22 
    23 install: install-local-test build install-bin install-lib install-doc install-man
    24 
    25 clean: clean-bin clean-lib clean-doc
    26 
    27 distclean: clean
    28 	@echo "  RM     Makefile"
    29 	@rm -f Makefile
    30 
    31 uninstall: install-local-test uninstall-bin uninstall-lib uninstall-doc uninstall-man
    32 
    33 ###############################################################################
    34 # Specific make rules
    35 
    36 #--------------------------------------
    37 # Build rules
    38 
    39 build-bin: ct-ng
    40 	@echo "  CHMOD  $<"
    41 	@chmod a+x $<
    42 
    43 build-lib:
    44 
    45 build-man: docs/ct-ng.1.gz
    46 
    47 docs/ct-ng.1.gz: docs/ct-ng.1
    48 	@echo "  GZIP   $@"
    49 	@gzip -c9 $< >$@
    50 
    51 %: %.in
    52 	@echo "  SED    $@"
    53 	@sed -r -e 's,@@CT_MAKE@@,$(MAKE),g;'       \
    54 	        -e 's,@@CT_BINDIR@@,$(BINDIR),g;'   \
    55 	        -e 's,@@CT_LIBDIR@@,$(LIBDIR),g;'   \
    56 	        -e 's,@@CT_DOCDIR@@,$(DOCDIR),g;'   \
    57 	        -e 's,@@CT_MANDIR@@,$(MANDIR),g;'   \
    58 	        -e 's,@@CT_VERSION@@,$(VERSION),g;'	\
    59 	        -e 's,@@CT_DATE@@,$(DATE),g;'       \
    60 	     $@.in >$@
    61 
    62 #--------------------------------------
    63 # Clean rules
    64 
    65 clean-bin:
    66 	@echo "  RM     ct-ng"
    67 	@rm -f ct-ng
    68 
    69 clean-lib:
    70 
    71 clean-doc:
    72 	@echo "  RM     docs/ct-ng.1"
    73 	@rm -f docs/ct-ng.1
    74 	@echo "  RM     docs/ct-ng.1.gz"
    75 	@rm -f docs/ct-ng.1.gz
    76 
    77 #--------------------------------------
    78 # Install rules
    79 
    80 # If using localy, don't install
    81 install-local-test:
    82 	@if [ "$(LOCAL)" = "1" ]; then                                          \
    83 	     echo "You're using local copy as runtime. You can't (un)install."; \
    84 	     false;                                                             \
    85 	 fi
    86 
    87 install-bin: install-local-test $(BINDIR)
    88 	@echo "  INST   ct-ng"
    89 	@install -m 755 ct-ng $(BINDIR)/ct-ng
    90 
    91 install-lib: install-local-test $(LIBDIR) install-lib-main install-lib-samples
    92 
    93 install-lib-main: install-local-test $(LIBDIR)
    94 	@for src_dir in config kconfig patches scripts tools; do            \
    95 	     echo "  INST   $${src_dir}/";                                  \
    96 	     tar cf - --exclude=.svn $${src_dir} |(cd $(LIBDIR); tar xf -); \
    97 	 done
    98 	@rm -f $(LIBDIR)/tools/addToolVersion.sh
    99 	@for src_file in steps.mk .version; do                 \
   100 	     echo "  INST   $${src_file}";                          \
   101 	     install -m 644 $${src_file} $(LIBDIR)/$${src_file};    \
   102 	 done
   103 
   104 # Samples need a little love:
   105 #  - change every occurence of CT_TOP_DIR to CT_LIB_DIR
   106 install-lib-samples: install-local-test $(LIBDIR) install-lib-main
   107 	@echo "  INST   samples/"
   108 	@tar cf - --exclude=.svn samples |(cd $(LIBDIR); tar xf -)
   109 	@for samp_file in $(LIBDIR)/samples/*/crosstool.config; do                  \
   110 	     sed -r -i -e 's,\$$\{CT_TOP_DIR\},\$$\{CT_LIB_DIR\},g;' $${samp_file}; \
   111 	 done
   112 
   113 install-doc: install-local-test $(DOCDIR)
   114 	@for doc_file in docs/CREDITS docs/overview.txt; do	\
   115 	     echo "  INST   $${doc_file}";              	\
   116 	     install -m 644 "$${doc_file}" $(DOCDIR);   	\
   117 	 done
   118 
   119 install-man: install-local-test $(MANDIR)
   120 	@echo "  INST   ct-ng.1.gz"
   121 	@install -m 644 docs/ct-ng.1.gz $(MANDIR)
   122 
   123 $(BINDIR) $(LIBDIR) $(DOCDIR) $(MANDIR)::
   124 	@echo "  MKDIR  $@"
   125 	@install -m 755 -d $@
   126 
   127 
   128 #--------------------------------------
   129 # Uninstall rules
   130 
   131 uninstall-bin: install-local-test
   132 	@rm -f $(BINDIR)/ct-ng
   133 
   134 uninstall-lib: install-local-test
   135 	@rm -rf $(LIBDIR)
   136 
   137 uninstall-doc: install-local-test
   138 	@rm -rf $(DOCDIR)
   139 
   140 uninstall-man: install-local-test
   141 	@rm -f $(MANDIR)/ct-ng.1{,.gz}