Makefile 1.32 KB
Newer Older
1
include ../py/mkenv.mk
2
-include mpconfigport.mk
3

4
# define main target
5
PROG = micropython
6

7
8
9
# qstr definitions (must come before including py.mk)
QSTR_DEFS = qstrdefsport.h

10
11
# include py core make definitions
include ../py/py.mk
12

13
# compiler settings
14
CFLAGS = -I. -I$(PY_SRC) -Wall -Werror -ansi -std=gnu99 -DUNIX $(CFLAGS_MOD) $(COPT)
15
16
17
18
19
20
21

UNAME_S := $(shell uname -s)
 ifeq ($(UNAME_S),Darwin)
    LDFLAGS = $(LDFLAGS_MOD) -lm -Wl,-map,$@.map
else
    LDFLAGS = $(LDFLAGS_MOD) -lm -Wl,-Map=$@.map,--cref
 endif
22

23
24
25
26
27
28
29
30
31
32
ifeq ($(MICROPY_FORCE_32BIT),1)
CFLAGS += -m32
LDFLAGS += -m32
ifeq ($(MICROPY_MOD_FFI),1)
ifeq ($(UNAME_S),Linux)
CFLAGS_MOD += -I/usr/include/i686-linux-gnu
endif
endif
endif

33
34
35
36
37
38
ifeq ($(MICROPY_USE_READLINE),1)
CFLAGS_MOD += -DMICROPY_USE_READLINE=1
LDFLAGS_MOD += -lreadline
# the following is needed for BSD
#LDFLAGS_MOD += -ltermcap
endif
39
40
ifeq ($(MICROPY_MOD_TIME),1)
CFLAGS_MOD += -DMICROPY_MOD_TIME=1
41
SRC_MOD += modtime.c
42
endif
43
ifeq ($(MICROPY_MOD_FFI),1)
44
CFLAGS_MOD += `pkg-config --cflags libffi` -DMICROPY_MOD_FFI=1
45
LDFLAGS_MOD += -ldl -lffi
46
SRC_MOD += modffi.c
47
48
endif

49

50
# Debugging/Optimization
51
ifdef DEBUG
52
53
CFLAGS += -g
COPT = -O0
54
else
55
COPT = -Os #-DNDEBUG
56
57
endif

58
# source files
59
60
SRC_C = \
	main.c \
61
	gccollect.c \
62
	file.c \
63
	modsocket.c \
64
	$(SRC_MOD)
65

66
OBJ = $(PY_O) $(addprefix $(BUILD)/, $(SRC_C:.c=.o))
67

68
include ../py/mkrules.mk
69