程序例
#include<stdio.h>
#include<math.h>
int main(void)
{
double result;
double x=0.5;
result=atan(x);
printf("Thearctangentof%lfis%lf\n",x,result);
return(0);
}
Makefile 文件:
CXX=g++
CFLAGS=-O3 -Wall -fmessage-length=0 -fPIC -DARCH_x86
OBJS=atan.o
LIBS+=
TARGET= Tatan
$(TARGET):$(OBJS)
$(CXX) -o $(TARGET) $(OBJS) $(CFLAGS) $(LIBS)
chmod 6755 $(TARGET)
all:$(TARGET)
install: all
chmod 6755 $(TARGET)
clean:
rm -f $(OBJS) $(TARGET)
程序运行结果:
[root@localhost atan]# make
make: Warning: File `Makefile' has modification time 59 s in the future
cc -O3 -Wall -fmessage-length=0 -fPIC -DARCH_x86 -c -o atan.o atan.c
g++ -o Tatan atan.o -O3 -Wall -fmessage-length=0 -fPIC -DARCH_x86
chmod 6755 Tatan
make: warning: Clock skew detected. Your build may be incomplete.
[root@localhost atan]# ./Tatan
The arctangent of 0.500000 is 0.463648