forked from DOMjudge/domjudge
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile.global
86 lines (69 loc) · 2.49 KB
/
Makefile.global
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
# Global Makefile
#
# Put here all things that need or can be defined globally, like
# standard targets (clean, etc.) and global variables.
# Prevent this file from being included more than once
ifndef GLOBALINCLUDED
GLOBALINCLUDED=1
# Check for QUIET environment variable:
ifneq ($(QUIET),)
QUIET=1
MAKEFLAGS += --no-print-directory --quiet
endif
# Define the 'default' target here: because of inclusion of this file,
# it will be the default target in all subdirectories and we default to
# no automatic targets when calling 'make' unless overridden.
default:
# Include variables set by configure:
ifneq ($(wildcard $(TOPDIR)/paths.mk),)
include $(TOPDIR)/paths.mk
endif
# Determine revision info:
REVISION = $(shell \
if [ -n "$(PUBLISHED)" ]; then \
echo "$(PUBLISHED)" ; \
elif git describe >/dev/null 2>&1 ; then \
git describe --long | sed 's/^.*-//' ; \
else \
echo 'unknown' ; \
fi )
CFLAGS += -DREVISION="\"$(REVISION)\""
CXXFLAGS += -DREVISION="\"$(REVISION)\""
# Install settings
INSTALL_PROG = $(INSTALL)
INSTALL_DATA = $(INSTALL) -m 0644
INSTALL_USER = $(INSTALL) -m 0644 -o $(DOMJUDGE_USER)
INSTALL_WEBSITE = $(INSTALL) -m 0644 -o $(DOMJUDGE_USER) -g $(WEBSERVER_GROUP)
INSTALL_DIR = $(MKDIR_P)
# This is a bit of a hack:
INSTALL_TREE = cp -R
# Library objects required in multiple places:
LIBSBASE = $(addprefix $(TOPDIR)/lib/,lib.error lib.misc)
LIBHEADERS = $(addsuffix .h,$(LIBSBASE))
LIBSOURCES = $(addsuffix .c,$(LIBSBASE))
LIBOBJECTS = $(addsuffix $(OBJEXT),$(LIBSBASE))
CFLAGS += -I$(TOPDIR)/lib -I$(TOPDIR)/etc
CXXFLAGS += -I$(TOPDIR)/lib -I$(TOPDIR)/etc
$(LIBOBJECTS): %$(OBJEXT): %.c %.h
$(MAKE) -C $(TOPDIR)/lib $(notdir $@)
# Default recursive targets; these should always at least call the
# TARGET-l variant:
REC_TARGETS += dist clean distclean maintainer-clean
# Recursive rule, runs in depth-first traversal. TARGET-l is the local
# variant that is called after traversing all subdirectories.
$(REC_TARGETS): %:
@[ -n "$(QUIET)" -o -z "$(SUBDIRS)" ] || echo "Recursing target \`$@' into:" $(SUBDIRS)
@for dir in $(SUBDIRS) ; do $(MAKE) -C $$dir $@ || exit 1 ; done
@$(MAKE) $@-l
# Predefine local variants of recursive targets, so that they are
# available from the above call:
dist-l:
clean-l:
distclean-l: clean-l
maintainer-clean-l: distclean-l
.PHONY: default $(REC_TARGETS) $(addsuffix -l,$(REC_TARGETS)) check config \
clean clean-l distclean distclean-l maintainer-clean maintainer-clean-l
endif # GLOBALINCLUDED
# Local Variables:
# mode: makefile
# end: