| 1 |
# |
| 2 |
# Copyright (c) 2000, 2001 Dmitry Butskoy |
| 3 |
# <[email protected]> |
| 4 |
# License: GPL v2 or any later |
| 5 |
# |
| 6 |
# See COPYING for the status of this software. |
| 7 |
# |
| 8 |
|
| 9 |
# |
| 10 |
# Global Makefile. |
| 11 |
# Global rules, targets etc. |
| 12 |
# |
| 13 |
# See Make.defines for specific configs. |
| 14 |
# |
| 15 |
|
| 16 |
|
| 17 |
srcdir = $(CURDIR) |
| 18 |
|
| 19 |
override TARGET := .MAIN |
| 20 |
|
| 21 |
dummy: all |
| 22 |
|
| 23 |
include ./Make.rules |
| 24 |
|
| 25 |
|
| 26 |
targets = $(EXEDIRS) $(LIBDIRS) $(MODDIRS) |
| 27 |
|
| 28 |
|
| 29 |
# be happy, easy, perfomancy... |
| 30 |
.PHONY: $(subdirs) dummy all force |
| 31 |
.PHONY: depend indent clean distclean libclean release store libs mods |
| 32 |
|
| 33 |
|
| 34 |
allprereq := $(EXEDIRS) |
| 35 |
|
| 36 |
ifneq ($(LIBDIRS),) |
| 37 |
libs: $(LIBDIRS) |
| 38 |
ifneq ($(EXEDIRS),) |
| 39 |
$(EXEDIRS): libs |
| 40 |
else |
| 41 |
allprereq += libs |
| 42 |
endif |
| 43 |
endif |
| 44 |
|
| 45 |
ifneq ($(MODDIRS),) |
| 46 |
mods: $(MODDIRS) |
| 47 |
ifneq ($(MODUSERS),) |
| 48 |
$(MODUSERS): mods |
| 49 |
else |
| 50 |
allprereq += mods |
| 51 |
endif |
| 52 |
ifneq ($(LIBDIRS),) |
| 53 |
$(MODDIRS): libs |
| 54 |
endif |
| 55 |
endif |
| 56 |
|
| 57 |
all: $(allprereq) |
| 58 |
|
| 59 |
depend install: $(allprereq) |
| 60 |
|
| 61 |
$(foreach goal,$(filter install-%,$(MAKECMDGOALS)),\ |
| 62 |
$(eval $(goal): $(patsubst install-%,%,$(goal)))) |
| 63 |
|
| 64 |
|
| 65 |
what = all |
| 66 |
depend: what = depend |
| 67 |
install install-%: what = install |
| 68 |
|
| 69 |
ifneq ($(share),) |
| 70 |
$(share): shared = yes |
| 71 |
endif |
| 72 |
ifneq ($(noshare),) |
| 73 |
$(noshare): shared = |
| 74 |
endif |
| 75 |
|
| 76 |
|
| 77 |
$(targets): mkfile = $(if $(wildcard $@/Makefile),,-f $(srcdir)/default.rules) |
| 78 |
|
| 79 |
$(targets): force |
| 80 |
@$(MAKE) $(mkfile) -C $@ $(what) TARGET=$@ |
| 81 |
|
| 82 |
force: |
| 83 |
|
| 84 |
|
| 85 |
indent: |
| 86 |
find . -type f -name "*.[ch]" -print -exec $(INDENT) {} \; |
| 87 |
|
| 88 |
clean: |
| 89 |
rm -f $(foreach exe, $(EXEDIRS), ./$(exe)/$(exe)) nohup.out |
| 90 |
rm -f `find . \( -name "*.[oa]" -o -name "*.[ls]o" \ |
| 91 |
-o -name core -o -name "core.[0-9]*" -o -name a.out \) -print` |
| 92 |
|
| 93 |
distclean: clean |
| 94 |
rm -f `find $(foreach dir, $(subdirs), $(dir)/.) \ |
| 95 |
\( -name "*.[oa]" -o -name "*.[ls]o" \ |
| 96 |
-o -name core -o -name "core.[0-9]*" -o -name a.out \ |
| 97 |
-o -name .depend -o -name "_*" -o -name ".cross:*" \) \ |
| 98 |
-print` |
| 99 |
|
| 100 |
|
| 101 |
libclean: |
| 102 |
rm -f $(foreach lib, $(LIBDIRS), ./$(lib)/$(lib).a ./$(lib)/$(lib).so) |
| 103 |
|
| 104 |
|
| 105 |
# Rules to make whole-distributive operations. |
| 106 |
# |
| 107 |
|
| 108 |
STORE_DIR = $(HOME)/pub |
| 109 |
|
| 110 |
release release1 release2 release3: |
| 111 |
@./chvers.sh $@ |
| 112 |
@$(MAKE) store |
| 113 |
|
| 114 |
store: distclean |
| 115 |
@./store.sh $(NAME) $(STORE_DIR) |
| 116 |
|
| 117 |
|