-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
90 lines (65 loc) · 1.73 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
LIBCMINI=../libcmini
LIBCMINI_INCLUDE=$(LIBCMINI)/include
LIBCMINI_LIB=$(LIBCMINI)/build/
TOOLCHAIN_PREFIX=m68k-atari-mint
CXX=$(TOOLCHAIN_PREFIX)-c++
CC=$(TOOLCHAIN_PREFIX)-gcc
DEPEND=depend
STACK=$(TOOLCHAIN_PREFIX)-stack
STACKSIZE=360K
FLAGS=$(TOOLCHAIN_PREFIX)-flags
TARGET=mini++.prg
CPPSRCS= \
libcmini_kludge.cpp \
main.cpp \
image.cpp \
screen.cpp \
sprite.cpp \
degas_picture.cpp
CPPOBJS = $(patsubst %.cpp, %.o, $(CPPSRCS))
CSRCS = \
natfeats.c
COBJS = $(patsubst %.c,%.o,$(CSRCS))
ASRCS = \
nf_asm.S
AOBJS = $(patsubst %.S,%.o,$(ASRCS))
OBJS = $(CPPOBJS) $(COBJS) $(AOBJS)
CXXFLAGS=-fomit-frame-pointer \
-Wall \
-O2 \
--no-exceptions \
--no-rtti \
-std=c++0x \
-nostdlib \
-DGLIBCXX_NOEXCEPT
# for the global constructors to be called, we need to link libgcc twice
# since __main() resides in libgcc.
LDFLAGS=-s -lstdc++ -L$(LIBCMINI_LIB) -lgcc -lcmini -lgcc -Wl,-Map,mapfile
all: $(TARGET)
$(TARGET):$(OBJS) depend
echo $(OBJS) $(LIBCMINI_INCLUDE)
$(CXX) $(CXXFLAGS) $(LIBCMINI_LIB)/crt0.o $(OBJS) $(LDFLAGS) -o $@
$(STACK) -S $(STACKSIZE) $(TARGET)
$(FLAGS) --mno-fastram --mno-fastalloc $(TARGET)
%.o%.cc:
$(CXX) -c -I$(LIBCMINI_INCLUDE) $< -o $@
%.o%.c:
$(CC) -c -I$(LIBCMINI_INCLUDE) $< -o $@
%.o%.S:
$(CC) -c $< -o $@
.PHONY: clean
clean:
- rm -f $(OBJS) $(TARGET) $(DEPEND)
strip: $(TARGET)
$(TOOLCHAIN_PREFIX)-strip $?
$(DEPEND): $(CPPSRCS) $(CSRCS)
- rm -f $(DEPEND)
$(CXX) $(CXXFLAGS) -I$(LIBCMINI_INCLUDE) -M $? >> $(DEPEND)
.PHONY: printvars
printvars:
$(foreach V,$(.VARIABLES), $(if $(filter-out environment% default automatic, $(origin $V)),$(warning $V=$($V))))
release:
tar cvzf libcmini-cplusplus.tar.gz mini++.prg images
ifneq (clean,$(MAKECMDGOALS))
-include $(DEPEND)
endif