-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
39 lines (30 loc) · 1000 Bytes
/
Makefile
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
# This makfile tests whether "make" is executed in the object
# directory.
# If it is, it simply includes the Automakefile Makefile-am.
# Otherwise, it assumes that it is executed in the source
# directory and tries to run make in the objdir.
SUBMAKEFILE := Makefile-am
# Test if we are in the objdir
ifeq ($(shell test -f ./$(SUBMAKEFILE) && echo "yes"),yes)
# if we are, simply use the automakefile
include $(SUBMAKEFILE)
else
# else test if the objdir is already in place and configured
objdir := obj-$(shell config/config.guess)
ifeq ($(shell test -d $(objdir) && test -f $(objdir)/$(SUBMAKEFILE) && echo "yes"),yes)
# if it is, run make in the objdir
# add phony targets to the following
# all doc %: FORCE
# cd $(objdir) && $(MAKE) --print-directory $@
.PHONY: all doc
all doc %:: FORCE
cd $(objdir) && $(MAKE) --print-directory $@
FORCE:
# otherwise try to run configure
else
all:
@echo "No configured directory found, running configure..."
@./configure
@$(MAKE) $@
endif
endif