Makefile.in
author "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Sun Jan 18 17:45:10 2009 +0000 (2009-01-18)
changeset 1143 eee9e8de51e3
parent 1141 60cda89df6cf
child 1152 73a8bb20ccf2
permissions -rw-r--r--
Rename scripts/crosstool.sh to scripts/crosstool-NG.sh.
After all, this is not crosstool, but really crosstool-NG!

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