-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMakefile
executable file
·101 lines (79 loc) · 2.79 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
91
92
93
94
95
96
97
98
99
100
101
#
# xrick/Makefile
#
# Copyright (C) 1998-2002 BigOrno (bigorno@bigorno.net). All rights reserved.
#
# The use and distribution terms for this software are contained in the file
# named README, which can be found in the root of this distribution. By
# using this software in any fashion, you are agreeing to be bound by the
# terms of this license.
#
# You must not remove this notice, or any other, from this software.
#
# Vars
#
SDLVERSION=$(shell /opt/miyoo/arm-miyoo-linux-uclibcgnueabi/sysroot/usr/bin/sdl-config --version 2>/dev/null)
ROOTDIR=
#$(shell pwd)
TARGET=$(shell uname -s | tr [a-z] [A-Z])
PROFILE= APPLY
OPTIMISE= -D_ZAURUS -O2 -ffast-math -fstrict-aliasing -fomit-frame-pointer -ftree-vectorize -funroll-all-loops -fpeel-loops -ftracer -funswitch-loops -finline-functions
ifeq ($(PROFILE), YES)
OPTIMISE += -fprofile-generate=/mnt/profile
else ifeq ($(PROFILE), APPLY)
OPTIMISE += -fprofile-use -fbranch-probabilities
endif
#
# Config
#
ifeq ($(strip $(SDLVERSION)),)
$(error SDL is missing)
else
$(warning Detected SDL version $(SDLVERSION))
endif
ifeq ($(strip $(SDLVERSION)),)
$(error SDL is missing)
endif
SDL_MAJ=$(word 1,$(subst ., ,$(SDLVERSION)))
SDL_MIN=$(word 2,$(subst ., ,$(SDLVERSION)))
SDL_MIC=$(word 3,$(subst ., ,$(SDLVERSION)))
SDL_MAJ_REQ=1
SDL_MIN_REQ=2
SDL_MIC_REQ=1
SDL_CHKVER=$(shell if [ $(SDL_MAJ) -lt $(SDL_MAJ_REQ) ]; then echo "BAD"; fi)
ifeq ($(SDL_CHKVER),BAD)
$(error SDL version $(SDL_MAJ_REQ).$(SDL_MIN_REQ).$(SDL_MIC_REQ) is required)
endif
SDL_CHKVER=$(shell if [ $(SDL_MAJ) -eq $(SDL_MAJ_REQ) -a $(SDL_MIN) -lt $(SDL_MIN_REQ) ]; then echo "BAD"; fi)
ifeq ($(SDL_CHKVER),BAD)
$(error SDL version $(SDL_MAJ_REQ).$(SDL_MIN_REQ).$(SDL_MIC_REQ) is required)
endif
SDL_CHKVER=$(shell if [ $(SDL_MAJ) -eq $(SDL_MAJ_REQ) -a $(SDL_MIN) -eq $(SDL_MIN_REQ) -a $(SDL_MIC) -lt $(SDL_MIC_REQ) ]; then echo "BAD"; fi)
ifeq ($(SDL_CHKVER),BAD)
$(error SDL version $(SDL_MAJ_REQ).$(SDL_MIN_REQ).$(SDL_MIC_REQ) is required)
endif
ifneq (,$(findstring CYGWIN,$(TARGET)))
XOBJ=xrick.res
endif
ifneq (,$(findstring MINGW,$(TARGET)))
XOBJ=xrick.res
endif
#
# Rules
#
all:
@echo "ROOTDIR=" > Makefile.global
@echo "XOBJ=$(XOBJ)" >> Makefile.global
@echo "CFLAGS=-g -ansi -pedantic -Wall -W -O2 -I $(ROOTDIR)/include $(shell /opt/miyoo/arm-miyoo-linux-uclibcgnueabi/sysroot/usr/bin/sdl-config --cflags) $(OPTIMISE)" >> Makefile.global
@echo "LDFLAGS=-lz $(shell /opt/miyoo/arm-miyoo-linux-uclibcgnueabi/sysroot/usr/bin/sdl-config --libs) -fprofile-arcs" >> Makefile.global
@echo "CC=arm-miyoo-linux-uclibcgnueabi-gcc" >> Makefile.global
@echo "CPP=arm-miyoo-linux-uclibcgnueabi-gcc -E" >> Makefile.global
$(MAKE) -C src all
clean:
for i in src include; do \
$(MAKE) -C $$i clean; \
done
rm -f *~ log.txt Makefile.global
depend:
$(MAKE) -C src depend
# eof