-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
33 lines (24 loc) · 985 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
EXAMPLES = ascii sprite scroller test
INCDIR = include
SRCDIR = src
OBJDIR = obj
EXAMPLEDIR = examples
EXAMPLEBINDIR = examples/bin
LIB_SRC = $(wildcard src/*.c) $(wildcard src/*.asm)
EXAMPLEAPPS = $(foreach example, $(EXAMPLES), $(EXAMPLEBINDIR)/$(addsuffix .COM,$(shell echo $(example) | tr A-Z a-z)))
EXAMPLEBINS = $(foreach example, $(EXAMPLES), $(EXAMPLEBINDIR)/$(addsuffix .bin,$(example)))
COMPILER_ASM_FILES = $(foreach example, $(EXAMPLES), $(EXAMPLEDIR)/$(addsuffix .c.asm,$(example))) \
$(foreach example, $(wildcard src/*.c), $(addsuffix .asm,$(example)))
DEPS = $(wildcard include/*.h) $(wildcard src/*.h)
$(EXAMPLES): $(DEPS)
mkdir -p $(EXAMPLEBINDIR)
zcc +cpm -vn -I$(INCDIR) -I$(SRCDIR) $(EXAMPLEDIR)/[email protected] $(LIB_SRC) -o $(EXAMPLEBINDIR)/[email protected] -create-app
all: $(EXAMPLES)
rm -f $(EXAMPLEBINS)
.PHONY: clean
clean:
rm -f $(EXAMPLEAPPS)
rm -Rf $(EXAMPLEBINDIR)
rm -f $(EXAMPLEDIR)/zcc_opt.def
rm -f zcc_opt.def
rm -f $(COMPILER_ASM_FILES)