【求助】求助:向各位大哥请教一个 makefile 问题,谢谢!
请教:! ]5 _1 Y$ `4 `
makefile 文件是怎么得到的,
% i3 q5 X) o' ]! ]$ W是不是我打开记事本,然后把它保存为 *.mk
, O" n, p3 T* Q" a
& @3 R8 E9 Q( @0 @4 I如果不是这样的话,是不是在终端输入什么命令?6 D5 ^$ P7 \. A2 Q, w
( _7 z1 l. y& h( S7 ?$ d还是别的方法建立 makefile 文件呢?
# X+ |+ f/ q" O+ c4 B I$ k: ^/*compute.c源程序的代码*/
: a" p& |" Q5 C6 r' u8 G8 U2 T6 A" M4 z+ @" j- e* A( L
extern int somegrobal;6 i, J, y& J, z% C' f
) q& q" T" B7 h9 G1 O& ^int computer(void){1 w+ s* V. ^( n. g' M
return 5*somegrobal;/ g6 o* Q( G+ N+ A9 w6 l/ J4 a
}
* Q8 s( E K2 I
& ?7 M7 {; [9 r1 d/*源程序init.c的代码*/
1 O$ G- U4 ~2 B5 L! X* S- u C9 }8 K! l5 H
#include <stdio.h>; k8 l. @6 C2 e8 C/ ?
#include ”myprogram.h“
. D( G1 L5 l# J
; }) y; p9 V1 Y5 Q6 F0 d* xint somegrobal=11;
! ?- c# z i+ @, R; F3 _" P( D4 a* U: |7 \% m
int main(void){
2 A2 J% ?4 B: F j foo();) d8 G5 N$ y* W' G% E8 g: e+ ^
return 0;
5 ]2 \- V( m: b- q; R}: P1 @: B6 h& U1 W) ? _
4 X8 L3 k8 t v+ W
/*源文件io.c的代码*/
: Y4 l: _' Y8 y. g/ q+ B. w
" W: e4 G8 A* g/ K% j; z$ b* o#include <stdio.h>- E1 f/ v( v8 x7 g' ?
#include “myprogram.h”
$ i7 t3 L1 W. o9 N6 _! X! H) }
6 @( h$ g+ D+ ]! }! aint foo(void){+ H( ]6 t" |' v3 p l* ^
printf(“The value is:%d.\n”,computer());
8 f4 N; u; L+ N1 A( _$ v return 1;: v `8 T% Y' `. V! ^2 J3 x6 X
}
9 p) @+ [) C4 }9 a) `: `9 H# i; m* e5 M0 r. W
/*头文件myprogram.h的代码*/
- G3 x( y* t4 c* }7 b5 n3 N4 I0 e3 K
int computer(void);
0 I& E) O1 \4 R( ^4 L/ nint foo(void);8 e( l0 T- a$ S% S$ P! V
. M# k) f3 E# q
8 @ M! F' ?3 Q//应用程序 test1 ,它是由 3 个 C 源程序和一个头文件组成。三个源程序是
9 S! Y: P* H- y8 c2 B4 o* L//compute.c,init.c 和 io.c ,头文件为 myprogram.h
7 j- s: w( I; I% c
5 }; `1 |" v# l e- f5 Q y- D8 i1 N1 C/ z# }
各位大哥,就我上面的程序给我写一个 makefile 的例子,好吗?
" n9 i( v2 ^- X8 r/ q% j# M0 `3 c7 m9 _- x
感激不尽!