-
Notifications
You must be signed in to change notification settings - Fork 0
/
makefile
46 lines (38 loc) · 1.32 KB
/
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
40
41
42
43
44
45
46
RM := rm.exe
COMPILE_FLAGS = -c -O -ansi
LINKER_FLAGS = -O -ansi
HALUGEN_FLAGS = -cardtype MI-M4
MELCERTGEN_FLAGS = -cardtype MI-M4 -alist 7 -adf
# Outputs
OUTPUT_NAME = sample
OUTPUT_DIR = bin
OUTPUT_HZX = $(OUTPUT_DIR)/$(OUTPUT_NAME).hzx
OUTPUT_LST = $(OUTPUT_DIR)/$(OUTPUT_NAME).lst
OUTPUT_ALU = $(OUTPUT_DIR)/$(OUTPUT_NAME).alu
OUTPUT_CERTS = $(OUTPUT_DIR)/$(OUTPUT_NAME)
OUTPUT_ALC = $(OUTPUT_DIR)/$(OUTPUT_NAME).alc
OUTPUT_ADC = $(OUTPUT_DIR)/$(OUTPUT_NAME).adc
# Source Directories
C_SRCS_DIRS += \
src
# Source Files
C_SRCS += $(foreach dir,$(C_SRCS_DIRS),$(wildcard $(C_SRCS_DIRS)/*.c))
# Object Files
OBJS = $(foreach dir,$(C_SRCS_DIRS),$(addprefix $(OUTPUT_DIR)/,$(patsubst %.c,%.hzo,$(notdir $(wildcard $(C_SRCS_DIRS)/*.c)))))
all: sample
# Compile source code
$(OUTPUT_DIR)/%.hzo: src/%.c
@if not exist "$(OUTPUT_DIR)" mkdir "$(OUTPUT_DIR)"
@echo 'Building file: $<'
@echo 'Invoking: SmartDeck Compiler'
hcl $(COMPILE_FLAGS) -o "$@" "$<"
@echo 'Finished building: $<'
$(OUTPUT_NAME): $(OBJS)
@echo 'Invoking: SmartDeck Linker'
hcl $(LINKER_FLAGS) -o "$(OUTPUT_HZX)" $(OBJS)
@hls "$(OUTPUT_HZX)" > $(OUTPUT_LST)
@halugen $(HALUGEN_FLAGS) -o $(OUTPUT_ALU) $(OUTPUT_HZX)
@melcertgen $(OUTPUT_CERTS) $(MELCERTGEN_FLAGS) -hzx $(OUTPUT_HZX)
@echo 'Finished building: $(OUTPUT_ALU)'
clean:
$(RM) -rf $(OUTPUT_DIR)