fpgatools/Makefile.common
minux b1377a323b Makefile.common: don't export CC, AR, ... to sub-make
Or we might prepend "@echo .." two times.
Reproduced by: CC=gcc make

Signed-off-by: minux <minux.ma@gmail.com>
2013-01-16 10:06:36 +08:00

64 lines
1.8 KiB
Makefile

#
# 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 = /bin/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)