-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
88 lines (64 loc) · 1.81 KB
/
Copy pathMakefile
File metadata and controls
88 lines (64 loc) · 1.81 KB
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
# http://www.nongnu.org/avr-libc/user-manual/group__demo__project.html
# Modified by zhiyb (Yubo Zhi) - For Qt
PRG = 2048
SRC = main.cpp mainw.cpp pathmgr.cpp grid.cpp tile.cpp cell.cpp animation.cpp
MOCH = grid.h cell.h animation.h mainw.h
SUBDIRS =
VERSION = 0.0.1
#CROSS = mipsel-linux-
OPTIMIZE = -O3
STRIP = true
DEFS = -DQWS -pipe -fno-exceptions -fno-rtti -Wall -Wno-non-virtual-dtor -Werror
LIBS = -Wl,-rpath,/opt/qt-2.3.10.new/lib -lqpe -lqte
#QTDIR = /root/qt/qt-2.3.10.mipsel
#QPEDIR = /root/qt/qtopia-free-1.5.0.mipsel
QTINC = $(QTDIR)/include
QPEINC = $(QPEDIR)/include
QTLIB = $(QTDIR)/lib
QPELIB = $(QPEDIR)/lib
# You should not have to change anything below here.
MOCC = $(addprefix moc_,$(subst .h,.cpp,$(MOCH)))
OBJ = $(subst .cpp,.o,$(SRC) $(MOCC))
CC = $(CROSS)g++
LN = $(CROSS)g++
STRIP += && $(CROSS)strip
MOC = $(QTDIR)/bin/moc
CFLAGS = -g -c $(DEFS) $(OPTIMIZE) -I$(QTINC) -I$(QPEINC)
LDFLAGS = -g $(LIBS) -L$(QTLIB) -L$(QPELIB)
all: subdirs $(MOCC) $(PRG)
$(MOCC): moc_%.cpp: %.h
$(MOC) -o $@ $<
$(PRG): $(OBJ)
$(LN) $(LDFLAGS) -o $@ $^
$(STRIP) $@ || true
%.o: %.cpp
$(CC) $(CFLAGS) -o $@ $<
# Subdirectories
.PHONY: subdirs $(SUBDIRS)
subdirs: $(SUBDIRS)
$(SUBDIRS):
$(MAKE) -C $@
# Dependency:
-include $(OBJ:.o=.d)
%.d: %.cpp
@set -e; rm -f $@; \
$(CC) -MM $(CFLAGS) $< > $@.$$$$; \
sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \
rm -f $@.$$$$
# Clean up
.PHONY: clean
clean:
for d in $(SUBDIRS); do (cd $$d; $(MAKE) clean); done
rm -rf $(OBJ) $(MOCC) *.d *.d.* $(PRG) $(EXTRA_CLEAN_FILES)
# Publish: source code & hex target archive
TAR = tar
TARFLAGS = -jc
ARCHIVE = $(PRG)-$(VERSION).tar.bz2
EXTRA_CLEAN_FILES += $(ARCHIVE)
.PHONY: archive
archive: $(ARCHIVE)
$(ARCHIVE): $(PRG)
$(TAR) $(TARFLAGS) -f $(ARCHIVE) $(SRC) $(MOCH) *.h $(PRG) Makefile
.PHONY: run
run: all
./$(PRG)