-
Notifications
You must be signed in to change notification settings - Fork 0
/
Config.mk
98 lines (73 loc) · 1.99 KB
/
Config.mk
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
# Copyright (c) 2006-2010, Intel Corporation
# All rights reserved.
# -*- mode: Makefile; -*-
#
# global build settings
#
# supported targets
.PHONY: all build install dist clean distclean mrproper
# Default target
all : build
# debug build
debug ?= n
# for dist targets
ifdef DESTDIR
DISTDIR = $(DESTDIR)
#else
#DISTDIR ?= /
endif
DESTDIR ?= $(ROOTDIR)/dist
dist : DISTDIR=$(DESTDIR)
#
# tools and flags for components built to run on build (host)
#
# cc-option: Check if compiler supports first option, else fall back to second.
# Usage: cflags-y += $(call cc-option,$(CC),-march=winchip-c6,-march=i586)
cc-option = $(shell if test -z "`$(1) $(2) -S -o /dev/null -xc \
/dev/null 2>&1`"; then echo "$(2)"; else echo "$(3)"; fi ;)
CFLAGS_WARN = -Wall -Wformat-security -Werror -Wstrict-prototypes \
-Wextra -Winit-self -Wswitch-default -Wunused-parameter \
-Wwrite-strings \
$(call cc-option,$(CC),-Wlogical-op,) \
-Wno-missing-field-initializers
AS = as
LD = ld
CC = gcc
CPP = cpp
AR = ar
RANLIB = ranlib
NM = nm
STRIP = strip
OBJCOPY = objcopy
OBJDUMP = objdump
ifeq ($(debug),n)
INSTALL_STRIP = -s
endif
INSTALL = install
INSTALL_DIR = $(INSTALL) -d -m0755 -p
INSTALL_DATA = $(INSTALL) -m0644 -p
INSTALL_PROG = $(INSTALL) $(INSTALL_STRIP) -m0755 -p
#
# tools and flags for components built to run on target
#
TARGET_ARCH ?= $(shell uname -m | sed -e s/i.86/x86_32/ -e s/i86pc/x86_32/)
CFLAGS += $(CFLAGS_WARN) -fno-strict-aliasing -std=gnu99
# due to bug in gcc v4.2,3,?
CFLAGS += $(call cc-option,$(CC),-Wno-array-bounds,)
ifeq ($(debug),y)
CFLAGS += -g -DDEBUG
else
CFLAGS += -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2
endif
ifeq ($(TARGET_ARCH),x86_64)
LIBDIR := lib64
CFLAGS += -m64
else
LIBDIR := lib
CFLAGS += -m32 -march=i686
endif
CFLAGS += -I$(ROOTDIR)/safestringlib/include
# common dummy rule to force execution
.PHONY: FORCE
FORCE :
@: # do nothing