-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
60 lines (42 loc) · 1.16 KB
/
Makefile
File metadata and controls
60 lines (42 loc) · 1.16 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
54
55
56
57
58
59
60
SRCS = hello.asm
LIBS =
ASMFLAGS = -g -mc3 -mgf
LINKFLAGS = -sEntry -tfxa2560x
TARGET = hello.pgz
CLEAN = $(addsuffix .clean,$(dir $(LIBS)))
ASM = motor68k
LIB = xlib
LINK = xlink
DEPDIR := .d
DEPFLAGS = -d$(DEPDIR)/$*.Td
ifeq ($(MAKE_HOST),Windows32)
$(shell mkdir $(DEPDIR) >NUL 2>&1)
POSTCOMPILE = @move /Y $(DEPDIR)\$*.Td $(DEPDIR)\$*.d >NUL && type NUL >>$@
REMOVEALL = del /S /Q $(TARGET) $(notdir $(SRCS:asm=obj)) $(DEPDIR) >NUL
else
$(shell mkdir -p $(DEPDIR) >/dev/null)
POSTCOMPILE = @mv -f $(DEPDIR)/$*.Td $(DEPDIR)/$*.d && touch $@
REMOVEALL = rm -rf $(TARGET) $(notdir $(SRCS:asm=obj)) $(DEPDIR)
endif
ASSEMBLE = $(ASM) $(DEPFLAGS) $(ASMFLAGS)
$(TARGET) : $(notdir $(SRCS:asm=obj)) $(LIBS)
$(LINK) $(LINKFLAGS) -m$@.sym -o$@ $+
%.obj : %.asm
%.obj : %.asm $(DEPDIR)/%.d
$(ASSEMBLE) -o$@ $<
$(POSTCOMPILE)
$(DEPDIR)/%.d: ;
.PRECIOUS: $(DEPDIR)/%.d
clean : $(CLEAN)
$(REMOVEALL)
%.clean:
@$(MAKE) -C $* clean
# Make subdirs
SUBDIRS = $(dir $(LIBS))
subdirs: $(SUBDIRS)
.PHONY: subdirs $(SUBDIRS)
$(LIBS): subdirs
$(SUBDIRS):
@$(MAKE) -C $(@D)
# Include dependency info
include $(wildcard $(patsubst %,$(DEPDIR)/%.d,$(basename $(notdir $(SRCS)))))