-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathcommon.mk
executable file
·192 lines (171 loc) · 4.67 KB
/
common.mk
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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
# (c) 2011 Mandriva, http://www.mandriva.com
#
# $Id$
#
# This file is part of Pulse 2, http://pulse2.mandriva.org
#
# Pulse 2 is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# Pulse 2 is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Pulse 2; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
# MA 02110-1301, USA.
#
include $(topdir)/version.mk
.DEFAULT_GOAL = all
DISTCLEANFILES =
CLEANFILES = *~
ARCHITECTURE = i386
CC = gcc
archivebase = $(project)-$(version)-source
archivedate := $(shell date +%Y%m%d%H%M%S)
binarybase := $(project)-$(linux_version)+$(archivedate)
#
# Paths
#
imaginglibdir = /usr/lib/pulse2/imaging
imagingdir = /var/lib/pulse2/imaging
bootloaderdir = $(imagingdir)/bootloader
disklessdir = $(imagingdir)/diskless
postinstdir = $(imagingdir)/postinst
computersdir = $(imagingdir)/computers
mastersdir = $(imagingdir)/masters
initramfsdir = $(imagingdir)/initramfs/initrd
initcdfsdir = $(imagingdir)/initramfs/initrdcd
# Tools related dirs
lrs_topdir = $(topdir)/tools/revosave
bindir = $(initramfsdir)/bin
usrbindir = $(initramfsdir)/usr/bin
libdir = $(initramfsdir)/lib
usrlibdir = $(initramfsdir)/usr/lib
rcdir = $(initramfsdir)/etc/init.d
revobindir = $(initramfsdir)/revobin
#
# Tools
#
install = $(shell which install)
install_DATA = $(install) -m 644
install_BIN = $(install) -m 755
#
# Some useful rules
#
gcc_arch = $(shell gcc -dumpmachine | sed 's/^\([^-]\+\)-.*/\1/')
check-arch:
@case $(gcc_arch) in \
i?86) \
;; \
*) \
echo "###"; \
echo "### Must be built on i386 system"; \
echo "###"; \
exit 1; \
;; \
esac
check-root:
@if test `id -u` -ne 0; then \
echo "###"; \
echo "### You must be root"; \
echo "###"; \
exit 1; \
fi
# Stolen from a automake generated makefile, a little bit modified:
# - Do not use portable 'cd'
# - Dir local rules are called *-local, not *-am
# - Do not use maintainer-clean target
# - Must handle the case *-local rules are not defined
RECURSIVE_TARGETS = all-recursive install-recursive
RECURSIVE_CLEAN_TARGETS = clean-recursive distclean-recursive
all: all-recursive
install: install-recursive
clean: clean-recursive
distclean: distclean-recursive
$(RECURSIVE_TARGETS):
@fail= failcom='exit 1'; \
for f in x $$MAKEFLAGS; do \
case $$f in \
*=* | --[!k]*);; \
*k*) failcom='fail=yes';; \
esac; \
done; \
dot_seen=no; \
target=`echo $@ | sed s/-recursive//`; \
list='$(SUBDIRS)'; for subdir in $$list; do \
echo "Making $$target in $$subdir"; \
local_target=; \
if test "$$subdir" = "."; then \
dot_seen=yes; \
local_target="$$target-local"; \
else \
local_target="$$target"; \
fi; \
(cd $$subdir && $(MAKE) $$target-common && $(MAKE) $$local_target) \
|| eval $$failcom; \
done; \
if test "$$dot_seen" = "no"; then \
$(MAKE) $$target-common && $(MAKE) $$target-local || exit 1; \
fi; test -z "$$fail"
all-common: check-arch
ifeq ($(nobuild),1)
install-common:
else
install-common: all
endif
mkdir -p $(imagingdir)
$(RECURSIVE_CLEAN_TARGETS):
@fail= failcom='exit 1'; \
for f in x $$MAKEFLAGS; do \
case $$f in \
*=* | --[!k]*);; \
*k*) failcom='fail=yes';; \
esac; \
done; \
dot_seen=no; \
rev=''; list='$(SUBDIRS)'; for subdir in $$list; do \
if test "$$subdir" = "."; then :; else \
rev="$$subdir $$rev"; \
fi; \
done; \
rev="$$rev ."; \
target=`echo $@ | sed s/-recursive//`; \
for subdir in $$rev; do \
echo "Making $$target in $$subdir"; \
local_target=; \
if test "$$subdir" = "."; then \
local_target="$$target-local"; \
else \
local_target="$$target"; \
fi; \
(cd $$subdir && $(MAKE) $$local_target $$target-common) \
|| eval $$failcom; \
done && test -z "$$fail"
clean-common:
find -name '*~' -exec rm {} \;
for file in $(CLEANFILES); do \
rm -f $$file; \
done
distclean-common: clean
for file in $(DISTCLEANFILES); do \
rm -f $$file; \
done
for dir in `find -type d -name 'tmp.*'`; do \
rm -rf $$dir; \
done
#
# Dummy rules in case they are not included in calling Makefile
#
all-local:
install-local:
clean-local:
distclean-local:
.PHONY = $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) all-local \
install-local clean-local distclean-local check-arch \
check-root
.PHONY: $(PHONY)