Makefile 944 Bytes
Newer Older
1
# define main target
2
PROG = micropython
3
4
all: $(PROG)

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

8
9
# include py core make definitions
include ../py/py.mk
10

11
12
# program for deletion
RM = /bin/rm
Dave Hylands's avatar
Dave Hylands committed
13
ECHO = @echo
14
15

# compiler settings
16
CC = gcc
17
CFLAGS = -I. -I$(PY_SRC) -Wall -Werror -ansi -std=gnu99 -DUNIX
18
LDFLAGS = -lm
19

20
21
22
23
24
25
26
#Debugging/Optimization
ifdef DEBUG
CFLAGS += -Og -ggdb
else
CFLAGS += -Os #-DNDEBUG
endif

27
# source files
28
29
SRC_C = \
	main.c \
30
	file.c \
31
	socket.c \
32

33
OBJ = $(PY_O) $(addprefix $(BUILD)/, $(SRC_C:.c=.o))
Damien's avatar
Damien committed
34
LIB = -lreadline
35
36
# the following is needed for BSD
#LIB += -ltermcap
37
38

$(PROG): $(BUILD) $(OBJ)
Dave Hylands's avatar
Dave Hylands committed
39
40
	$(ECHO) "LINK $<"
	$(Q)$(CC) -o $@ $(OBJ) $(LIB) $(LDFLAGS)
41
ifndef DEBUG
Dave Hylands's avatar
Dave Hylands committed
42
	$(Q)strip $(PROG)
43
endif
Dave Hylands's avatar
Dave Hylands committed
44
	$(Q)size $(PROG)
45

46
$(BUILD)/%.o: %.c $(QSTR_DEFS)
Dave Hylands's avatar
Dave Hylands committed
47
48
	$(ECHO) "CC $<"
	$(Q)$(CC) $(CFLAGS) -c -o $@ $<
49

50
$(BUILD)/main.o: mpconfigport.h
51
52

clean:
53
54
	$(RM) -f $(PROG)
	$(RM) -rf $(BUILD)
55

56
.PHONY: all clean