Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1063282
  • 博文数量: 284
  • 博客积分: 8223
  • 博客等级: 中将
  • 技术积分: 3188
  • 用 户 组: 普通用户
  • 注册时间: 2008-12-01 13:26
文章分类

全部博文(284)

文章存档

2012年(18)

2011年(33)

2010年(83)

2009年(147)

2008年(3)

分类: C/C++

2009-08-07 10:30:23

makefile:
 

LIB = -lrt -lfun

all : clean libfun.a sem end

.PHONY : all

clean :

   -rm ./exe/*.o ./exe/core ./exe/libfun.a sem

libfun.a : libfun.o

   ar rcs libfun.a libfun.o

libfun.o : libfun.c

   cc -g -c libfun.c

sem : sem.o

   cc -g -o sem sem.o $(LIB)

sem.o : sem.c

   cc -g -c sem.c $(LIB)

end :

   -mkdir exe

   -mv *.o core *.a sem ./exe/

sem.c :

#include <stdlib.h>
#include <stdio.h>
#include <strings.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>

extern void pp();
void main(int argc,char **argv[])
{
   pp();
}

libfun.c :

#include <stdlib.h>
#include <stdio.h>
void pp();

void pp()
{
   printf("i am toy\n");
}

阅读(507) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~