# common.mk

**URL:** <https://forums.developer.nvidia.com/t/common-mk/7157>\
**Category:** CUDA Programming and Performance\
**Created:** [January 9, 2009, 11:19am UTC](https://forums.developer.nvidia.com/t/common-mk/7157 "2009-01-09T11:19:44Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![tatou1234](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@tatou1234](https://forums.developer.nvidia.com/u/tatou1234)\
**Post date:** [January 9, 2009, 11:19am UTC](https://forums.developer.nvidia.com/t/common-mk/7157/1 "2009-01-09T11:19:44Z")

</div>

hi,  
I don’t understand very well some lines of common.mk which is in cuda\_sdk.  
For example the lines between 202 and 221.  
what is the aim of ‘subst’? I suppose that is substitute but why?  
what is ‘ar’ and ‘qv’?

* * *

# Lib/exe configuration

ifneq ($(STATIC\_LIB),)  
TARGETDIR := $(LIBDIR)  
TARGET := $(subst .a,$(LIBSUFFIX).a,$(LIBDIR)/$(STATIC\_LIB))  
LINKLINE = ar qv $(TARGET) $(OBJS)  
else  
LIB += -lcutil$(LIBSUFFIX)  
# Device emulation configuration  
ifeq ($(emu), 1)  
NVCCFLAGS += -deviceemu  
CUDACCFLAGS +=  
BINSUBDIR := emu$(BINSUBDIR)  
# consistency, makes developing easier  
CXXFLAGS += -D\_\_DEVICE\_EMULATION\_\_  
CFLAGS += -D\_\_DEVICE\_EMULATION\_\_  
endif  
TARGETDIR := $(BINDIR)/$(BINSUBDIR)  
TARGET := $(TARGETDIR)/$(EXECUTABLE)  
LINKLINE = $(LINK) -o $(TARGET) $(OBJS) $(LIB)  
endif

* * *

thank you

---

<div class="post-metadata">

**Author:** ![tyoc](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@tyoc](https://forums.developer.nvidia.com/u/tyoc)\
**Post date:** [January 9, 2009, 4:29pm UTC](https://forums.developer.nvidia.com/t/common-mk/7157/2 "2009-01-09T16:29:34Z")

</div>

> [@](#):
>
> # Lib/exe configuration
> 
> ```
> LINKLINE = ar qv $(TARGET) $(OBJS)
> 
> ```

Only a quick ref http://unixhelp.ed.ac.uk/CGI/man-cgi?ar

IIRC ar is used for create static libs .a, that is all I can say.

---

<div class="post-metadata">

**Author:** ![tatou1234](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@tatou1234](https://forums.developer.nvidia.com/u/tatou1234)\
**Post date:** [January 12, 2009, 8:35am UTC](https://forums.developer.nvidia.com/t/common-mk/7157/3 "2009-01-12T08:35:37Z")

</div>

> [@](#):
>
> Only a quick ref http://unixhelp.ed.ac.uk/CGI/man-cgi?ar
> 
> IIRC ar is used for create static libs .a, that is all I can say.

thank you
