| 1 |
.SILENT: |
|---|
| 2 |
|
|---|
| 3 |
OBJECTIVE_DIRECTORIES = |
|---|
| 4 |
OBJECTIVE_LIBS = |
|---|
| 5 |
OBJECTIVE_LIBS_NOINST = |
|---|
| 6 |
OBJECTIVE_BINS = |
|---|
| 7 |
OBJECTIVE_DATA = |
|---|
| 8 |
SUBDIRS = |
|---|
| 9 |
HEADERS = |
|---|
| 10 |
V = 0 |
|---|
| 11 |
VERBOSE ?= $(V) |
|---|
| 12 |
VERBOSITY = 0 |
|---|
| 13 |
SHOW_CFLAGS ?= $(VERBOSE) |
|---|
| 14 |
|
|---|
| 15 |
LIBDIR = $(libdir) |
|---|
| 16 |
BINDIR = $(bindir) |
|---|
| 17 |
INCLUDEDIR = $(pkgincludedir) |
|---|
| 18 |
CFLAGS += -DHAVE_CONFIG_H -I/usr/pkg/include -I/usr/pkg/xorg/include |
|---|
| 19 |
CXXFLAGS += -DHAVE_CONFIG_H -I/usr/pkg/include -I/usr/pkg/xorg/include |
|---|
| 20 |
|
|---|
| 21 |
default: build |
|---|
| 22 |
|
|---|
| 23 |
install: build |
|---|
| 24 |
$(MAKE) install-prehook |
|---|
| 25 |
@for i in $(BINDIR) $(LIBDIR) $(INCLUDEDIR); do \ |
|---|
| 26 |
if [ ! -d $(DESTDIR)$$i ]; then \ |
|---|
| 27 |
$(INSTALL) -d -m 755 $(DESTDIR)$$i; \ |
|---|
| 28 |
fi; \ |
|---|
| 29 |
done; |
|---|
| 30 |
@if [ "x$(SUBDIRS)" != "x" ]; then \ |
|---|
| 31 |
for i in $(SUBDIRS); do \ |
|---|
| 32 |
if [ $(VERBOSITY) -gt 0 ]; then \ |
|---|
| 33 |
echo "[installing subobjective: $$i]"; \ |
|---|
| 34 |
fi; \ |
|---|
| 35 |
cd $$i; OVERLAYS="" $(MAKE) install || exit; cd ..; \ |
|---|
| 36 |
done; \ |
|---|
| 37 |
fi |
|---|
| 38 |
@if [ "x$(OBJECTIVE_DIRECTORIES)" != "x" ]; then \ |
|---|
| 39 |
for i in $(OBJECTIVE_DIRECTORIES); do \ |
|---|
| 40 |
printf "%10s %-20s\n" MKDIR $$i; \ |
|---|
| 41 |
$(INSTALL) -d -m 755 $(DESTDIR)$$i; \ |
|---|
| 42 |
done; \ |
|---|
| 43 |
fi |
|---|
| 44 |
@if [ "x$(OBJECTIVE_BINS)" != "x" ]; then \ |
|---|
| 45 |
for i in $(OBJECTIVE_BINS); do \ |
|---|
| 46 |
printf "%10s %-20s (-> $(DESTDIR)$(BINDIR))\n" INSTALL $$i; \ |
|---|
| 47 |
if [ "x$(DRY)" = "x" ]; then \ |
|---|
| 48 |
$(INSTALL) $(INSTALL_OVERRIDE) $$i $(DESTDIR)$(BINDIR)/$$i; \ |
|---|
| 49 |
fi; \ |
|---|
| 50 |
done; \ |
|---|
| 51 |
fi |
|---|
| 52 |
@if [ "x$(OBJECTIVE_DATA)" != "x" ]; then \ |
|---|
| 53 |
if [ "x$(NOINSTALL)" = "x" ]; then \ |
|---|
| 54 |
for i in $(OBJECTIVE_DATA); do \ |
|---|
| 55 |
source=`echo $$i | cut -d ":" -f1`; \ |
|---|
| 56 |
destination=`echo $$i | cut -d ":" -f2`; \ |
|---|
| 57 |
printf "%10s %-20s (-> $(DESTDIR)$$destination)\n" INSTALL $$source; \ |
|---|
| 58 |
if [ "x$(DRY)" = "x" ]; then \ |
|---|
| 59 |
if [ ! -d $(DESTDIR)$$destination ]; then \ |
|---|
| 60 |
$(INSTALL) -d -m 755 $(DESTDIR)$$destination; \ |
|---|
| 61 |
fi; \ |
|---|
| 62 |
$(INSTALL_DATA) $(INSTALL_OVERRIDE) $$source $(DESTDIR)$$destination; \ |
|---|
| 63 |
fi; \ |
|---|
| 64 |
done; \ |
|---|
| 65 |
fi; \ |
|---|
| 66 |
fi |
|---|
| 67 |
$(MAKE) install-posthook |
|---|
| 68 |
@if [ $(VERBOSITY) -gt 0 ]; then \ |
|---|
| 69 |
echo "[all objectives installed]"; \ |
|---|
| 70 |
fi |
|---|
| 71 |
|
|---|
| 72 |
clean: |
|---|
| 73 |
$(MAKE) clean-prehook |
|---|
| 74 |
@if [ "x$(OVERLAYS)" != "x" ]; then \ |
|---|
| 75 |
for i in `find $(OVERLAYS) -type d -maxdepth 1 -mindepth 1`; do \ |
|---|
| 76 |
if [ $(VERBOSITY) -gt 0 ]; then \ |
|---|
| 77 |
echo "[cleaning overlay: $$i]"; \ |
|---|
| 78 |
fi; \ |
|---|
| 79 |
cd $$i; OVERLAYS="" $(MAKE) clean || exit; cd ..; \ |
|---|
| 80 |
done; \ |
|---|
| 81 |
fi |
|---|
| 82 |
@if [ "x$(SUBDIRS)" != "x" ]; then \ |
|---|
| 83 |
for i in $(SUBDIRS); do \ |
|---|
| 84 |
if [ $(VERBOSITY) -gt 0 ]; then \ |
|---|
| 85 |
echo "[cleaning subobjective: $$i]"; \ |
|---|
| 86 |
fi; \ |
|---|
| 87 |
cd $$i; OVERLAYS="" $(MAKE) clean || exit; cd ..; \ |
|---|
| 88 |
done; \ |
|---|
| 89 |
fi |
|---|
| 90 |
$(MAKE) clean-posthook |
|---|
| 91 |
rm -f *.o *.lo *.so *.a *.sl .depend-done .depend |
|---|
| 92 |
touch .depend |
|---|
| 93 |
@if [ "x$(OBJECTIVE_BINS)" != "x" ]; then \ |
|---|
| 94 |
for i in $(OBJECTIVE_BINS); do \ |
|---|
| 95 |
rm -f $$i; \ |
|---|
| 96 |
done; \ |
|---|
| 97 |
fi |
|---|
| 98 |
@if [ "x$(OBJECTIVE_LIBS)" != "x" ]; then \ |
|---|
| 99 |
for i in $(OBJECTIVE_LIBS); do \ |
|---|
| 100 |
rm -f $$i; \ |
|---|
| 101 |
done; \ |
|---|
| 102 |
fi |
|---|
| 103 |
@if [ "x$(OBJECTIVE_LIBS_NOINST)" != "x" ]; then \ |
|---|
| 104 |
for i in $(OBJECTIVE_LIBS_NOINST); do \ |
|---|
| 105 |
rm -f $$i; \ |
|---|
| 106 |
done; \ |
|---|
| 107 |
fi |
|---|
| 108 |
@if [ $(VERBOSITY) -gt 0 ]; then \ |
|---|
| 109 |
echo "[all objectives cleaned]"; \ |
|---|
| 110 |
fi |
|---|
| 111 |
|
|---|
| 112 |
distclean: clean |
|---|
| 113 |
@if [ "x$(OVERLAYS)" != "x" ]; then \ |
|---|
| 114 |
for i in `find $(OVERLAYS) -type d -maxdepth 1 -mindepth 1`; do \ |
|---|
| 115 |
if [ $(VERBOSITY) -gt 0 ]; then \ |
|---|
| 116 |
echo "[distcleaning overlay: $$i]"; \ |
|---|
| 117 |
fi; \ |
|---|
| 118 |
cd $$i; OVERLAYS="" $(MAKE) distclean || exit; cd ..; \ |
|---|
| 119 |
done; \ |
|---|
| 120 |
fi |
|---|
| 121 |
@if [ "x$(SUBDIRS)" != "x" ]; then \ |
|---|
| 122 |
for i in $(SUBDIRS); do \ |
|---|
| 123 |
if [ $(VERBOSITY) -gt 0 ]; then \ |
|---|
| 124 |
echo "[distcleaning subobjective: $$i]"; \ |
|---|
| 125 |
fi; \ |
|---|
| 126 |
cd $$i; OVERLAYS="" $(MAKE) distclean || exit; cd ..; \ |
|---|
| 127 |
done; \ |
|---|
| 128 |
fi |
|---|
| 129 |
@if [ -f mk/rules.mk ]; then \ |
|---|
| 130 |
rm -f mk/rules.mk; \ |
|---|
| 131 |
fi |
|---|
| 132 |
|
|---|
| 133 |
build: depend |
|---|
| 134 |
$(MAKE) build-prehook |
|---|
| 135 |
@if [ "x$(OVERLAYS)" != "x" ]; then \ |
|---|
| 136 |
for i in `find $(OVERLAYS) -type d -maxdepth 1 -mindepth 1`; do \ |
|---|
| 137 |
if [ $(VERBOSITY) -gt 0 ]; then \ |
|---|
| 138 |
echo "[building overlay: $$i]"; \ |
|---|
| 139 |
fi; \ |
|---|
| 140 |
cd $$i; OVERLAYS="" $(MAKE) || exit; cd ..; \ |
|---|
| 141 |
if [ $(VERBOSITY) -gt 0 ]; then \ |
|---|
| 142 |
echo "[finished overlay: $$i]"; \ |
|---|
| 143 |
fi; \ |
|---|
| 144 |
done; \ |
|---|
| 145 |
fi |
|---|
| 146 |
@if [ "x$(SUBDIRS)" != "x" ]; then \ |
|---|
| 147 |
for i in $(SUBDIRS); do \ |
|---|
| 148 |
if [ $(VERBOSITY) -gt 0 ]; then \ |
|---|
| 149 |
echo "[building subobjective: $$i]"; \ |
|---|
| 150 |
fi; \ |
|---|
| 151 |
cd $$i; OVERLAYS="" $(MAKE) || exit; cd ..; \ |
|---|
| 152 |
if [ $(VERBOSITY) -gt 0 ]; then \ |
|---|
| 153 |
echo "[finished subobjective: $$i]"; \ |
|---|
| 154 |
fi; \ |
|---|
| 155 |
done; \ |
|---|
| 156 |
fi |
|---|
| 157 |
@if [ "x$(OBJECTIVE_LIBS)" != "x" ]; then \ |
|---|
| 158 |
for i in $(OBJECTIVE_LIBS); do \ |
|---|
| 159 |
if [ $(VERBOSITY) -gt 0 ]; then \ |
|---|
| 160 |
echo "[building library objective: $$i]"; \ |
|---|
| 161 |
fi; \ |
|---|
| 162 |
$(MAKE) $$i || exit; \ |
|---|
| 163 |
if [ $(VERBOSITY) -gt 0 ]; then \ |
|---|
| 164 |
echo "[finished library objective: $$i]"; \ |
|---|
| 165 |
fi; \ |
|---|
| 166 |
done; \ |
|---|
| 167 |
fi |
|---|
| 168 |
@if [ "x$(OBJECTIVE_LIBS_NOINST)" != "x" ]; then \ |
|---|
| 169 |
for i in $(OBJECTIVE_LIBS_NOINST); do \ |
|---|
| 170 |
if [ $(VERBOSITY) -gt 0 ]; then \ |
|---|
| 171 |
echo "[building library dependency: $$i]"; \ |
|---|
| 172 |
fi; \ |
|---|
| 173 |
$(MAKE) $$i || exit; \ |
|---|
| 174 |
if [ $(VERBOSITY) -gt 0 ]; then \ |
|---|
| 175 |
echo "[finished library dependency: $$i]"; \ |
|---|
| 176 |
fi; \ |
|---|
| 177 |
done; \ |
|---|
| 178 |
fi |
|---|
| 179 |
@if test "x$(OBJECTIVE_BINS)" != "x"; then \ |
|---|
| 180 |
for i in $(OBJECTIVE_BINS); do \ |
|---|
| 181 |
if [ $(VERBOSITY) -gt 0 ]; then \ |
|---|
| 182 |
echo "[building binary objective: $$i]"; \ |
|---|
| 183 |
fi; \ |
|---|
| 184 |
$(MAKE) $$i || exit; \ |
|---|
| 185 |
if [ $(VERBOSITY) -gt 0 ]; then \ |
|---|
| 186 |
echo "[finished binary objective: $$i]"; \ |
|---|
| 187 |
fi; \ |
|---|
| 188 |
done; \ |
|---|
| 189 |
fi |
|---|
| 190 |
$(MAKE) build-posthook |
|---|
| 191 |
@if [ $(VERBOSITY) -gt 0 ]; then \ |
|---|
| 192 |
echo "[all objectives built]"; \ |
|---|
| 193 |
fi |
|---|
| 194 |
|
|---|
| 195 |
.c.o: |
|---|
| 196 |
@if [ $(SHOW_CFLAGS) -eq 1 ]; then \ |
|---|
| 197 |
printf "%10s %-20s (%s)\n" CC $< "${CFLAGS}"; \ |
|---|
| 198 |
else \ |
|---|
| 199 |
printf "%10s %-20s\n" CC $<; \ |
|---|
| 200 |
fi; |
|---|
| 201 |
$(CC) $(CFLAGS) -c $< -o $@ |
|---|
| 202 |
|
|---|
| 203 |
.cc.o .cxx.o: |
|---|
| 204 |
@if [ $(SHOW_CFLAGS) -eq 1 ]; then \ |
|---|
| 205 |
printf "%10s %-20s (%s)\n" CXX $< "${CXXFLAGS}"; \ |
|---|
| 206 |
else \ |
|---|
| 207 |
printf "%10s %-20s\n" CXX $<; \ |
|---|
| 208 |
fi; |
|---|
| 209 |
$(CXX) $(CXXFLAGS) -c $< -o $@ |
|---|
| 210 |
|
|---|
| 211 |
$(OBJECTIVE_LIBS): $(OBJECTS) |
|---|
| 212 |
if [ "x$(OBJECTS)" != "x" ]; then \ |
|---|
| 213 |
$(MAKE) $(OBJECTS) || exit; \ |
|---|
| 214 |
printf "%10s %-20s\n" LINK $@; \ |
|---|
| 215 |
(if [ "x$(SHARED_SUFFIX)" = "x.so" ]; then \ |
|---|
| 216 |
(if [ "x$(OBJECTIVE_SONAME_SUFFIX)" != "x" ]; then \ |
|---|
| 217 |
$(CC) $(PICLDFLAGS) -o $@ -Wl,-h$@.$(OBJECTIVE_SONAME_SUFFIX) $(OBJECTS) $(LDFLAGS) $(LIBADD); \ |
|---|
| 218 |
else \ |
|---|
| 219 |
$(CC) $(PICLDFLAGS) -o $@ -Wl,-h$@ $(OBJECTS) $(LDFLAGS) $(LIBADD); \ |
|---|
| 220 |
fi;) \ |
|---|
| 221 |
else \ |
|---|
| 222 |
$(CC) $(PICLDFLAGS) -o $@ $(OBJECTS) $(LDFLAGS) $(LIBADD); \ |
|---|
| 223 |
fi;) \ |
|---|
| 224 |
fi |
|---|
| 225 |
|
|---|
| 226 |
%.a: $(OBJECTS) |
|---|
| 227 |
if [ "x$(OBJECTS)" != "x" ]; then \ |
|---|
| 228 |
$(MAKE) $(OBJECTS) || exit; \ |
|---|
| 229 |
printf "%10s %-20s\n" LINK $@; \ |
|---|
| 230 |
$(AR) cr $@ $(OBJECTS); \ |
|---|
| 231 |
fi |
|---|
| 232 |
|
|---|
| 233 |
$(OBJECTIVE_BINS): $(OBJECTS) |
|---|
| 234 |
if [ "x$(OBJECTS)" != "x" ]; then \ |
|---|
| 235 |
$(MAKE) $(OBJECTS) || exit; \ |
|---|
| 236 |
printf "%10s %-20s\n" LINK $@; \ |
|---|
| 237 |
$(CC) -o $@ $(OBJECTS) $(LDFLAGS) $(LIBADD); \ |
|---|
| 238 |
fi |
|---|
| 239 |
|
|---|
| 240 |
clean-prehook: |
|---|
| 241 |
clean-posthook: |
|---|
| 242 |
build-prehook: |
|---|
| 243 |
build-posthook: |
|---|
| 244 |
install-prehook: |
|---|
| 245 |
install-posthook: |
|---|
| 246 |
|
|---|
| 247 |
mk/rules.mk: |
|---|
| 248 |
@if [ -f "configure" ]; then \ |
|---|
| 249 |
echo "[building rules.mk for posix target, run configure manually if you do not want this]"; \ |
|---|
| 250 |
sh configure $(CONFIG_OPTS); \ |
|---|
| 251 |
echo "[complete]"; \ |
|---|
| 252 |
fi |
|---|
| 253 |
|
|---|
| 254 |
.PHONY: .depend depend clean distclean |
|---|
| 255 |
.depend: |
|---|
| 256 |
|
|---|
| 257 |
|
|---|
| 258 |
depend: |
|---|
| 259 |
@if [ "x$(SUBDIRS)" != "x" ]; then \ |
|---|
| 260 |
for i in $(SUBDIRS); do \ |
|---|
| 261 |
if [ $(VERBOSITY) -gt 0 ]; then \ |
|---|
| 262 |
echo "[building depend file for subobjective: $$i]"; \ |
|---|
| 263 |
fi; \ |
|---|
| 264 |
cd $$i; touch .depend; $(MAKE) -f Makefile depend || exit; cd ..; \ |
|---|
| 265 |
if [ $(VERBOSITY) -gt 0 ]; then \ |
|---|
| 266 |
echo "[finished subobjective: $$i]"; \ |
|---|
| 267 |
fi; \ |
|---|
| 268 |
done; \ |
|---|
| 269 |
fi |
|---|
| 270 |
if [ ! -f .depend-done ]; then \ |
|---|
| 271 |
for i in ${SOURCES}; do \ |
|---|
| 272 |
echo "[generating dependencies for objective: $$i]"; \ |
|---|
| 273 |
${CC} -MM ${PICFLAGS} ${CPPFLAGS} ${CFLAGS} $$i >> .depend; \ |
|---|
| 274 |
done; \ |
|---|
| 275 |
touch .depend-done; \ |
|---|
| 276 |
fi; |
|---|
| 277 |
|
|---|
| 278 |
|
|---|
| 279 |
am--refresh: |
|---|
| 280 |
|
|---|
| 281 |
-include .depend |
|---|