-
Notifications
You must be signed in to change notification settings - Fork 8
/
Makefile
91 lines (82 loc) · 2.1 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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
#
# Check for a required build environment.
#
ifndef IMPERAS_HOME
IMPERAS_ERROR := $(error "Please source 'imperas.environ' to setup Imperas environment.")
endif
#
# Processors supported:
# PIC32 MX7
# PIC32 MZ
#
ifeq ($(CPU),mx7)
DEFINES = -DPIC32MX7
endif
ifeq ($(CPU),mz)
DEFINES = -DPIC32MZ
endif
#
# Board types supported:
# Microchip Explorer16
# Maximite Computer
# chipKIT Max32
# chipKIT WiFire
# Microchip MEB-II
#
ifeq ($(BOARD),explorer16)
DEFINES += -DEXPLORER16
endif
ifeq ($(BOARD),maximite)
DEFINES += -DMAXIMITE
endif
ifeq ($(BOARD),max32)
DEFINES += -DMAX32
endif
ifeq ($(BOARD),wifire)
DEFINES += -DWIFIRE
endif
ifeq ($(BOARD),meb2)
DEFINES += -DMEBII
endif
#
# Common options
#
OBJLIST = loadhex.o main.o sdcard.o spi.o uart.o vtty.o
OPTIMIZE = -O2
OBJDIR = obj-$(CPU)-$(BOARD)
OBJ = $(OBJDIR)/$(CPU).o \
$(addprefix $(OBJDIR)/,$(OBJLIST))
CFLAGS = -m32 -g -Wall -Werror $(OPTIMIZE) $(DEFINES) \
-I$(IMPERAS_HOME)/ImpPublic/include/common \
-I$(IMPERAS_HOME)/ImpPublic/include/host \
-I$(IMPERAS_HOME)/ImpProprietary/include/host
LDFLAGS = -m32
LIBS = -L$(IMPERAS_HOME)/bin/$(IMPERAS_ARCH) \
-lRuntimeLoader -lpthread
ifeq ($(CPU),)
all:
$(MAKE) CPU=mx7 BOARD=explorer16
$(MAKE) CPU=mx7 BOARD=max32
$(MAKE) CPU=mx7 BOARD=maximite
$(MAKE) CPU=mz BOARD=explorer16
$(MAKE) CPU=mz BOARD=wifire
$(MAKE) CPU=mz BOARD=meb2
else
all: pic32$(CPU)-$(BOARD)
endif
pic32$(CPU)-$(BOARD): $(OBJ)
$(CC) $(LDFLAGS) $(OBJ) $(LIBS) -o $@
$(OBJDIR)/%.o: %.c
@mkdir -p $(@D)
$(CC) $(CFLAGS) -c $< -o $@
clean:
rm -rf *.o *~ obj-* pic32mx7-* pic32mz-*
###
$(OBJDIR)/loadhex.o: loadhex.c globals.h
$(OBJDIR)/main.o: main.c globals.h
$(OBJDIR)/mx7.o: mx7.c globals.h pic32mx.h
$(OBJDIR)/mz.o: mz.c globals.h pic32mz.h
$(OBJDIR)/sdcard.o: sdcard.c globals.h
$(OBJDIR)/spi.o: spi.c globals.h pic32mx.h pic32mz.h
$(OBJDIR)/uart.o: uart.c globals.h pic32mx.h pic32mz.h
$(OBJDIR)/vtty.o: vtty.c globals.h