Makefile BSD: Difference between revisions

From 탱이의 잡동사니
Jump to navigation Jump to search
No edit summary
No edit summary
 
(One intermediate revision by the same user not shown)
Line 2: Line 2:
BSD makefile 내용 정리.
BSD makefile 내용 정리.


== Conditional Statements(#if, #ifndef etc..) ==
== bmake ==
<source lang=bash>
$ bmake
</source>
 
== include statements, conditionals and for loops ==
'''Example'''
<pre>
<pre>
.if $(VER) >= 2.4
.if $(VER) >= 2.4
Line 11: Line 17:
   TAG = 2.4_stable
   TAG = 2.4_stable
.endif
.endif
</pre>
=== .include ===
지정한 파일을 첨부한다. 보통 필요한 *.mk 파일들을 첨부하는데 사용한다.
<pre>
RDIR=../../../..
.include "${RDIR}/common/Mk/pre.mk"
</pre>
</pre>


=== exists(<arg>) ===
=== exists(<arg>) ===
해당 인자값(arg)이 존재하는지 여부를 리턴한다. 존재할 경우 1, 아니면 0을 리턴한다. 보통 .if 구문과 같이 쓰인다.
<pre>
<pre>
clean:
clean:
Line 23: Line 38:


== See also ==
== See also ==
* https://www.freebsd.org/cgi/man.cgi?make(1) - BSD make manual
* https://wiki.netbsd.org/bsd_make/ - BSD make
* https://wiki.netbsd.org/bsd_make/ - BSD make
* http://www.khmere.com/freebsd_book/html/ch01.html - FreeBSD System Programming Chapter 1
* http://www.khmere.com/freebsd_book/html/ch01.html - FreeBSD System Programming Chapter 1


[[category:makefile]]
[[category:makefile]]

Latest revision as of 13:57, 16 August 2016

Overview

BSD makefile 내용 정리.

bmake

<source lang=bash> $ bmake </source>

include statements, conditionals and for loops

Example

.if $(VER) >= 2.4
  TAG = 2.4_current
.elif $(VER) == 2.3
  TAG = 2.3_release
.else
  TAG = 2.4_stable
.endif

.include

지정한 파일을 첨부한다. 보통 필요한 *.mk 파일들을 첨부하는데 사용한다.

RDIR=../../../..

.include "${RDIR}/common/Mk/pre.mk"

exists(<arg>)

해당 인자값(arg)이 존재하는지 여부를 리턴한다. 존재할 경우 1, 아니면 0을 리턴한다. 보통 .if 구문과 같이 쓰인다.

clean:
    -rm -f *.o *.core
.if exists(tmp)
    -rm tmp/*.o
.endif

See also