Makefile 840 Bytes
Newer Older
1
2
3
4
5
6
# define main target
PROG = py
all: $(PROG)

# include py core make definitions
include ../py/py.mk
7

8
9
# program for deletion
RM = /bin/rm
Dave Hylands's avatar
Dave Hylands committed
10
ECHO = @echo
11
12

# compiler settings
13
CC = gcc
14
CFLAGS = -I. -I$(PY_SRC) -Wall -Werror -ansi -std=gnu99 -DUNIX
15
LDFLAGS = -lm
16

17
18
19
20
21
22
23
#Debugging/Optimization
ifdef DEBUG
CFLAGS += -Og -ggdb
else
CFLAGS += -Os #-DNDEBUG
endif

24
# source files
25
26
SRC_C = \
	main.c \
27
	file.c \
28
	socket.c \
29

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

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

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

47
$(BUILD)/main.o: mpconfigport.h
48
49

clean:
50
51
	$(RM) -f $(PROG)
	$(RM) -rf $(BUILD)
52

53
.PHONY: all clean