-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile.ARM+nc
60 lines (47 loc) · 1.91 KB
/
Makefile.ARM+nc
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
.PHONY: all config debug prerelease release wild help
ROOTDIR := $(CURDIR)
include $(ROOTDIR)/src-build/default-config.mk
# WARNING!
# If you want to move to another architecture, you might have to recompile ncurses from sources!
# cross-compiler
ifeq ($(strip $(CROSS_COMPILE)),)
CROSS_COMPILE := /home/striker/bin/cross-compile/gcc-linaro-4.9.4-2017.01-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-
endif
override CC := $(CROSS_COMPILE)gcc
override DEPDIR := $(ROOTDIR)/src-deps
# whole solution flags
CFLAGS := -ansi -Wextra -pedantic -Wno-unused-parameter
CFLAGS += -mabi=aapcs-linux -mfloat-abi=hard -march=armv7 -I$(DEPDIR)/ncurses/include
# link with target glibc by toolchain
# it is known for me how to link with target glibc, but not ncurses..
LDFLAGS := -mfloat-abi=hard -L$(DEPDIR)/ncurses/lib
# export ALL variables
export
# TARGETS
all: config
@CONFIG=$(CONFIG) $(MAKE) -$(MKFLG)C $(SRCDIR) projects
# BUILD CONFIGURATIONS
# optimized for eltex tc-50 thin client, you can set another one
# To build everything, type `make` or `make debug`, which are equal, or `make release`, or `make wild`
# To build one project, for ex. `cs` in wild configuration, type `CONFIG=wild make cs`
config:
CONFIG := $(shell echo $(CONFIG) | tr A-Z a-z)
ifeq ($(strip $(CONFIG)),wild)
CFLAGS += -O3 -D NDEBUG -D RELEASE -D WILDRELEASE
LDFLAGS += -s
else ifeq ($(strip $(CONFIG)),release)
CFLAGS += -O3 -D NDEBUG -D RELEASE
LDFLAGS += -s
else ifeq ($(strip $(CONFIG)),debug)
CFLAGS += -O0 -ggdb -ffunction-sections -D DEBUG
CFLAGS += -D VALGRIND_SUCKS
# ifeq ($(strip $(CONFIG)),prerelease)
else
CONFIG := prerelease
CFLAGS += -O3 -D NDEBUG -D RELEASE -g
endif
include $(ROOTDIR)/src-build/help.mk
# last resort target, to redirect all lower level targets
# https://www.gnu.org/software/make/manual/html_node/Last-Resort.html
%::
@CONFIG=$(CONFIG) $(MAKE) -$(MKFLG)C $(SRCDIR) $@