-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtarget.mk
More file actions
53 lines (40 loc) · 1.46 KB
/
target.mk
File metadata and controls
53 lines (40 loc) · 1.46 KB
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
BUILDDIR := build/
TARGETS := _libdataplus _libsh4a _libgraphics
OBJDIRS := $(addprefix $(BUILDDIR),$(TARGETS))
INSTALL_TARGET := libdataplus
# Define the rules to build in the target subdirectories.
#
MAKETARGET = $(MAKE) --no-print-directory -C $@ -f $(CURDIR)/Makefile \
SRCDIR=$(CURDIR)/src
all: $(OBJDIRS)
.PHONY: $(OBJDIRS)
$(OBJDIRS):
@echo "Building $@..."
+@[ -d $@ ] || mkdir -p $@
+@$(MAKETARGET) TARGET=$(patsubst _%,%,$(notdir $@))
# These rules keep make from trying to use the match-anything rule below to
# rebuild the makefiles--ouch! Obviously, if you don't follow my convention
# of using a `.mk' suffix on all non-standard makefiles you'll need to change
# the pattern rule.
#
Makefile : ;
%.mk :: ;
# Anything we don't know how to build will use this rule. The command is a
# do-nothing command, but the prerequisites ensure that the appropriate
# recursive invocations of make will occur.
#
% :: $(OBJDIRS) ;
# The clean rule is best handled from the source directory: since we're
# rigorous about keeping the target directories containing only target files
# and the source directory containing only source files, `clean' is as trivial
# as removing the target directories!
#
.PHONY: clean
clean:
@echo clean ...
@rm -rf $(BUILDDIR)
.PHONY: install
install: $(OBJDIRS)
@mkdir -p $(DEVKITPRO)/$(INSTALL_TARGET)/lib
@cp -frv include $(DEVKITPRO)/$(INSTALL_TARGET)
@cp -frv $(shell find $(BUILDDIR) -name '*.a') $(DEVKITPRO)/$(INSTALL_TARGET)/lib