Makefile 1.17 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) -DMICROPY_USE_COMPUTED_GOTO
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
ifeq ($(MICROPY_USE_READLINE),1)
CFLAGS_MOD += -DMICROPY_USE_READLINE=1
LDFLAGS_MOD += -lreadline
# the following is needed for BSD
#LDFLAGS_MOD += -ltermcap
endif
29
30
ifeq ($(MICROPY_MOD_TIME),1)
CFLAGS_MOD += -DMICROPY_MOD_TIME=1
31
SRC_MOD += modtime.c
32
endif
33
ifeq ($(MICROPY_MOD_FFI),1)
34
CFLAGS_MOD += `pkg-config --cflags libffi` -DMICROPY_MOD_FFI=1
35
LDFLAGS_MOD += -ldl -lffi
36
SRC_MOD += modffi.c
37
38
endif

39

40
# Debugging/Optimization
41
ifdef DEBUG
42
43
CFLAGS += -g
COPT = -O0
44
else
45
COPT = -Os #-DNDEBUG
46
47
endif

48
# source files
49
50
SRC_C = \
	main.c \
51
	gccollect.c \
52
	file.c \
53
	modsocket.c \
54
	$(SRC_MOD)
55

56
OBJ = $(PY_O) $(addprefix $(BUILD)/, $(SRC_C:.c=.o))
57

58
include ../py/mkrules.mk
59