[완료]makefile 에서 궁금한 점이 있습니다.(타겟의 위치)

fluei의 이미지

예를 들겠습니다.

all : diary

diary : memo.o main.o calendar.o
$(CC)-o $@ $^

memo.o : memo.c
$(CC) -c $@ $^
main.o : main.c
$(CC) -c $@ $^
calendar.o : calendar.c
$(CC) -c $@ $^

이런 소스가 있다면... diary 타겟을 먼저 읽고.. memo.o main.o 순서대로 읽잖아요..
문제는..

all : diary

memo.o : memo.c
$(CC) -c $@ $^
main.o : main.c
$(CC) -c $@ $^
calendar.o : calendar.c
$(CC) -c $@ $^

diary : memo.o main.o calendar.o
$(CC)-o $@ $^

이런식으로 구성이 되어있을때 입니다.
make 명령을 했을때.. 위에서 부터 아래로 수행을 하게 되는데..
diary타겟이 밑에 있지만 우선적으로 실행할수 있는 방법을 알고 싶습니다..

ktd2004의 이미지

all, memo.o, diary의 순서는 상관이 없습니다.
* all에서 diary로 가고,
* diary에서 memo.o, main.o, calendar.o로 가고,
* memo.o, main.o, calendar.o가 끝나면, diary를 수행하고,
* diary가 끝나면, all이 수행됨.

위와 같은 순서로 수행이 됩니다..

fluei의 이미지

all을 뺏어야 했네요...

make diary 라는 명령어를 안쓰고

make만 써서 할수있는 방법은 없을까요

ktd2004의 이미지

그냥 make만 하면, make는 가장 위에 있는 target을 실행합니다.

따라서 다음중에 하나를 선택하시면 될 것 같네요.

all : diary
 
 
diary : ...

혹은 diary 타켓을 맨위로 올리기...

hansolo의 이미지

make diary

하면 되지 않나요?

fluei의 이미지

밑에 부분에 diary타겟이 있어도..

우선적으로 diary타겟을 먼저 수행할수 있게요..

feanor의 이미지

GNU make인 경우

.DEFAULT_GOAL = diary

같이 하시면 됩니다만, 이렇게 하지 마시고, 윗분들 말씀처럼 가장 위의 타겟이 기본으로 실행되니까 맨 위에 all: diary를 넣으세요.

fluei의 이미지

중간에 있어도..우선적으로 처리할수 있는 부분을 찾고 있었습니다.

원하던 답변 주셔서 감사합니다..

ktd2004의 이미지

새로운 걸 하나 배워가네요.. :)
감사합니다.~~

댓글 달기

Filtered HTML

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

BBCode

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param>
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

Textile

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • You can use Textile markup to format text.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Markdown

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • Quick Tips:
    • Two or more spaces at a line's end = Line break
    • Double returns = Paragraph
    • *Single asterisks* or _single underscores_ = Emphasis
    • **Double** or __double__ = Strong
    • This is [a link](http://the.link.example.com "The optional title text")
    For complete details on the Markdown syntax, see the Markdown documentation and Markdown Extra documentation for tables, footnotes, and more.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Plain text

  • HTML 태그를 사용할 수 없습니다.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 줄과 단락은 자동으로 분리됩니다.
댓글 첨부 파일
이 댓글에 이미지나 파일을 업로드 합니다.
파일 크기는 8 MB보다 작아야 합니다.
허용할 파일 형식: txt pdf doc xls gif jpg jpeg mp3 png rar zip.
CAPTCHA
이것은 자동으로 스팸을 올리는 것을 막기 위해서 제공됩니다.