summaryrefslogtreecommitdiff
path: root/Makefile.in
blob: 2e7b75cba1ec370a5dca849fff908cbaa1f24dee (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
# Makefile.in for building crosstool-ng
# This file serves as source for the ./configure operation

all: build

###############################################################################
# Configuration variables

VERSION:= @@VERSION@@
BINDIR := @@BINDIR@@
LIBDIR := @@LIBDIR@@
DOCDIR := @@DOCDIR@@
MANDIR := @@MANDIR@@
DATE   := @@DATE@@
LOCAL  := @@LOCAL@@
MAKE   := $(shell which make || type -p make || echo /usr/bin/make)

###############################################################################
# Global make rules

build: build-bin build-lib build-doc

install: build install-bin install-lib install-doc

clean: clean-bin clean-lib clean-doc

distclean: clean
	@rm -f Makefile

uninstall: uninstall-bin uninstall-lib uninstall-doc

###############################################################################
# Specific make rules

#--------------------------------------
# Build rules

build-bin: ct-ng
	@chmod a+x ct-ng

build-lib:

build-doc: docs/ct-ng.1

%: %.in
	@sed -r -e 's,@@CT_MAKE@@,$(MAKE),g;'       \
	        -e 's,@@CT_BINDIR@@,$(BINDIR),g;'   \
	        -e 's,@@CT_LIBDIR@@,$(LIBDIR),g;'   \
	        -e 's,@@CT_DOCDIR@@,$(DOCDIR),g;'   \
	        -e 's,@@CT_MANDIR@@,$(MANDIR),g;'   \
	        -e 's,@@CT_VERSION@@,$(VERSION),g;'	\
	        -e 's,@@CT_DATE@@,$(DATE),g;'       \
	     $@.in >$@

#--------------------------------------
# Clean rules

clean-bin:
	@rm -f ct-ng

clean-lib:

clean-doc:
	@rm -f docs/ct-ng.1

#--------------------------------------
# Install rules

# If using localy, don't install
install-local:
	@if [ "$(LOCAL)" = "1" ]; then                                      \
	     echo "You're using local copy as runtime. You can't install."; \
	     false;                                                         \
	 fi

install-bin: install-local $(BINDIR)
	@install -m 755 ct-ng $(BINDIR)/ct-ng

install-lib: install-local $(LIBDIR) install-lib-main install-lib-samples

install-lib-main: install-local $(LIBDIR)
	@for src_dir in config kconfig patches scripts tools; do            \
	     tar cf - --exclude=.svn $${src_dir} |(cd $(LIBDIR); tar xf -); \
	 done
	@for src_file in Makefile.steps version; do                 \
	     install -m 644 $${src_file} $(LIBDIR)/$${src_file};    \
	 done

# Samples need a little love:
#  - change every occurence of CT_TOP_DIR to CT_LIB_DIR
install-lib-samples: install-local $(LIBDIR) install-lib-main
	@tar cf - --exclude=.svn samples |(cd $(LIBDIR); tar xf -)
	@for samp_file in $(LIBDIR)/samples/*/crosstool.config; do                  \
	     sed -r -i -e 's,\$$\{CT_TOP_DIR\},\$$\{CT_LIB_DIR\},g;' $${samp_file}; \
	 done

install-doc: install-local $(DOCDIR) $(MANDIR)
	@for doc_file in CREDITS docs/overview.txt; do  \
	     install -m 644 "$${doc_file}" $(DOCDIR);   \
	 done
	@install -m 644 docs/ct-ng.1 $(MANDIR)

$(BINDIR) $(LIBDIR) $(DOCDIR) $(MANDIR)::
	@install -m 755 -d $@


#--------------------------------------
# Uninstall rules

uninstall-bin:
	@rm -f $(BINDIR)/ct-ng

uninstall-lib:
	@rm -rf $(LIBDIR)

uninstall-doc:
	@rm -rf $(DOCDIR)
	@rm -f $(MANDIR)/ct-ng.1