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