File: make

package info (click to toggle)
ruby-rouge 4.6.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 6,836 kB
  • sloc: ruby: 38,168; sed: 2,071; perl: 152; makefile: 8
file content (162 lines) | stat: -rw-r--r-- 3,884 bytes parent folder | download | duplicates (2)
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
# A comment

VERSION := 0.1.$(shell git log --oneline | wc -l | sed -e "s/ //g")

# Simple assignments
LIST=			Parser Grammar Objects Python Modules Mac
STRING=			'--with-pydebug'
NUMBER=			2.6
DOT=			.
DIR=			/usr/local
DIR_LIST=		Modules/threadmodule.o  Modules/signalmodule.o 
CMD_WITH_SWITCH=	gcc -pthread
DIR_WITH_SWITCH=	/usr/bin/install -c
ALL_SWITCHES=		-g -Wall -Wstrict-prototypes
EMPTY=

# Interpolation
SINGLE_PARENS=		$(CC)
MULTI_PARENS=		$(LOCALMODLIBS) $(BASEMODLIBS)
CMD_AND_PARENS=		svnversion $(srcdir)
DIR_AND_PARENS=		$(srcdir)/Modules/makesetup
BRACES=			${INSTALL}
DIR_AND_BRACES==	${prefix}/man
BRACES_AND_SWITCH=	${INSTALL} -m 644

# Multiline assignment
MULTI=	\
	Modules/config.o \
	Modules/getpath.o \
	Modules/main.o \
	Modules/gcmodule.o

MULTI_WITH_PARENS=	\
	Modules/getbuildinfo.o \
	$(PARSER_OBJS) \
	$(OBJECT_OBJS)

# Definition
simple:			$(BUILDPYTHON) oldsharedmods sharedmods
$(interpol):		Modules/python.o $(LIBRARY) $(LDLIBRARY)
multi dir/file.c:	Makefile.pre \
			Modules/Setup.local

# Commands
commands: $(SHELL) $(MAKESETUP) -c $(srcdir)/Modules/config.c.in
	@echo "The Makefile was updated, you may need to re-run make."

commands/complex: $(srcdir)/Modules/Setup.dist
	@if test -f Modules/Setup; then \
		echo "-----------------------------------------------"; \
	fi

commands_switch:	all platform
			-find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f

frameworkaltinstallunixtools:
	cd Mac && $(MAKE) altinstallunixtools DESTDIR="$(DESTDIR)"

include SubMake.make # Insert lines from another file (which must exist)
-include Maybe.make  # Next 2 similar, but not an error if they doon't exist
sinclude DynamicDependencies.make

# Function expansions (including $(shell)) can occur anywhere
$(shell echo VARIABLE) := $(shell echo value)

$(shell echo $(TARGET1)) $(TARGET2) target3: \
	$(shell echo $(DEPENDENCY1)) $(DEPENDENCY2) dependency3
	touch $(shell echo target{1..3})
	@echo $(shell echo 1)
	@echo $(shell echo 2 )
	@echo ${shell echo 3}
	@echo ${shell echo 4 }

# Many other built-in functions exist
OBJECT_GOALS = $(filter %.o,${MAKECMDGOALS})

# User-defined functions can be used via $(call)
reverse = $(2) $(1)
foo = $(call reverse,a,b) # foo contains 'b a'

# Substitution references can be used when expanding variables
SOURCE = $(OBJECT:.o=.c)

# Alternative syntax for substitution references
foo = input1.txt
bar = $(foo:input%.txt=output%.bin) # set to 'output1.bin'

# Conditionals
ifdef THING
THING2 = $(THING)
else
THING2 = default
endif

ifeq ($(OS), Linux)
MES = "Hi, Linux"
else ifeq ($(OS), Darwin)
MES = "Hi, Mac"
else
MES = "Unknown"
endif

ifeq ($(TARGET),special) # syntax variant: parentheses and separating comma
TARGET = something_else
else
	ifneq '$(TARGET)' "don't" # syntax variant: either argument can be single or double quoted
TARGET = be_silly
	endif # and can be indented, even with tabs (so long as not in a recipe)
endif

count:
	echo one
	echo two
ifndef QUIET # conditionals can happen within recipes
	echo miss a few
endif
	echo one hundred

# Dollars must be escaped if a literal one is required

print_path:
	echo $$PATH

# The define Directive
define variable
define variable =
define variable :=
define variable ::=
define variable +=
define variable ?=

define PROGRAM_template =
	$(1): $$($(1)_OBJS) $$($(1)_LIBS:%=-l%)
	ALL_OBJS += $$($(1)_OBJS)
endef

# Secondary expansion
.SECONDEXPANSION:
ONEVAR = onefile
TWOVAR = twofile
myfile: $(ONEVAR) $$(TWOVAR)

main lib: $$(patsubst %.c,%.o,$$($$@_SRCS))

# The eval function
$(foreach prog,$(PROGRAMS),$(eval $(call PROGRAM_template,$(prog))))

# The override Directive
override define foo =
endef

override variable = value
override variable := value
override variable += more text
override CFLAGS += -g

# export/unexport
export variable = value
export variable := value
export variable += value
export variable
unexport variable