forked from mkoval/hax
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.mk
42 lines (31 loc) · 870 Bytes
/
build.mk
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
ALL_CFLAGS = $(ARCH_CFLAGS) $(CFLAGS)
ALL_LDFLAGS = $(ARCH_LDFLAGS) $(LDFLAGS)
ALL_ASFLAGS = $(ARCH_ASFLAGS) $(ASFLAGS)
ALL_MDFLAGS = $(ARCH_MDFLAGS) $(MDFLAGS)
# Use the path to this Makefile as the base directory of HAX.
LIBDIR := $(dir $(lastword $(MAKEFILE_LIST)))
LIBDIR := $(LIBDIR:/=)
ARCHDIR = $(LIBDIR)/arch_$(arch)
TARGET = $(prog)-$(arch).$(ARCH_EXT)
ifneq ($(arch),cortex)
ifneq ($(arch),pic)
$(error "unsupported architecture")
endif
endif
ifndef prog
$(error "unnamed program")
endif
VER:=hax$(shell $(LIBDIR)/get_version)
.SUFFIXES:
.PHONY: all clean build rebuild install
all: build
rebuild: | clean build
-include $(SRC:=.d)
include $(ARCHDIR)/build.mk
build: $(TARGET)
.PHONY: mrproper
mrproper:
@echo "MRPROPER"
@$(FIND) . -print \
| $(GREP) '.*\.\([od]\|elf\|hex\|bin\|map\|lss\|sym\|strip\)$$' \
| $(XARGS) -- $(RM)