Makefile 828 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

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

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

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

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

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

52
.PHONY: all clean