目录结构
./main.c
#include<stdio.h>
#include "./lib/jtlib1.h"
int main()
{
printf("running..\n");
sayhello();
return 0;
}
./makefile
main:main.c
gcc -o main main.c -ljtlib1
clean:
rm main
./lib/jtlib1.h
#ifndef _JTLIB1_H_
#define _JTLIB1_H_
void sayhello();
#endif
./lib/jtlib1.c
#include "jtlib1.h"
#include <stdio.h>
void sayhello()
{
printf("fu2ck this programer!\n");
}
./lib/makefile
libjtlib1.a:jtlib1.o
ar rcs libjtlib1.a jtlib1.o
jtlib.o:jtlib1.h 1tlib1.c
gcc -o jtlib1.o -c jtlib1.c
install:
cp -f ./libjtlib1.a /usr/lib/libjtlib1.a
clean:
rm -f *.o *.a
收藏于 2013-03-25
来自于百度空间