-
Notifications
You must be signed in to change notification settings - Fork 63
/
Makefile.common
63 lines (51 loc) · 1.77 KB
/
Makefile.common
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
#
# Makefile - fpgatools
# Author: Wolfgang Spraul
#
# This is free and unencumbered software released into the public domain.
# For details see the UNLICENSE file at the root of the source tree.
#
PREFIX ?= /usr/local
SHELL = bash
# -fno-omit-frame-pointer and -ggdb add almost nothing to execution
# time right now, so we can leave them in all the time.
CFLAGS_DBG = -fno-omit-frame-pointer -ggdb
CFLAGS += $(CFLAGS_DBG)
CFLAGS += -Wall -Wshadow -Wmissing-prototypes -Wmissing-declarations \
-Wno-format-zero-length -O2
# ----- Verbosity control -----------------------------------------------------
CPP := $(CPP) # make sure changing CC won't affect CPP
CC_normal := $(CC)
AR_normal := $(AR) rsc
DEPEND_normal := $(CPP) $(CFLAGS) -D__OPTIMIZE__ -MM -MG
RANLIB_normal := ranlib
CC_quiet = @echo " CC " $@ && $(CC_normal)
AR_quiet = @echo " AR " $@ && $(AR_normal)
DEPEND_quiet = @$(DEPEND_normal)
RANLIB_quiet = @$(RANLIB_normal)
ifeq ($(V),1)
CC = $(CC_normal)
AR = $(AR_normal)
DEPEND = $(DEPEND_normal)
RANLIB = $(RANLIB_normal)
else
CC = $(CC_quiet)
AR = $(AR_quiet)
DEPEND = $(DEPEND_quiet)
RANLIB = $(RANLIB_quiet)
endif
# because all sub Makefiles also include this file, no need to pass down
# these variables. or we risk producing "@echo ... && @echo ... && cc .."
# which is not correct.
unexport CC AR DEPEND RANLIB
# ----- Dependencies ----------------------------------------------------------
MKDEP = \
$(DEPEND) $< | \
sed \
-e 's|^$(basename $(notdir $<)).o:|$@:|' \
-e '/^\(.*:\)\? */{p;s///;s/ *\\\?$$/ /;s/ */:\n/g;H;}' \
-e '$${g;p;}' \
-e d >$(basename $@).d; \
[ "$${PIPESTATUS[*]}" = "0 0" ] || \
{ rm -f $(basename $@).d; exit 1; }
-include $(OBJS:.o=.d)