github.com/stackdocker/rkt@v0.10.1-0.20151109095037-1aa827478248/makelib/build_static_c_bin.mk (about)

     1  # inputs cleared after including this file:
     2  # BSCB_BINARY: path of a built binary
     3  # BSCB_SOURCES: sources used to build a binary
     4  # BSCB_HEADERS: headers used to build a binary
     5  # BSCB_ADDITIONAL_CFLAGS: additional CFLAGS passed to CC, just after CFLAGS
     6  
     7  # misc inputs (usually provided by default):
     8  # CC - C compiler
     9  # CFLAGS - flags passed to CC.
    10  
    11  _BSCB_PATH_ := $(lastword $(MAKEFILE_LIST))
    12  
    13  $(call forward-vars,$(BSCB_BINARY), \
    14  	CC CFLAGS BSCB_ADDITIONAL_CFLAGS BSCB_SOURCES)
    15  $(BSCB_BINARY): $(BSCB_SOURCES) $(BSCB_HEADERS)
    16  $(BSCB_BINARY): $(_BSCB_PATH_)
    17  	$(VQ) \
    18  	$(call vb,vt,CC,$(call vsp,$@)) \
    19  	$(CC) $(CFLAGS) $(BSCB_ADDITIONAL_CFLAGS) -o "$@" $(BSCB_SOURCES) -static -s
    20  
    21  CLEAN_FILES += $(BSCB_BINARY)
    22  
    23  $(call undefine-namespaces,BSCB _BSCB)