简单编译执行程序时常用的编译参数

来源:互联网 发布:广州国投网络批发城 编辑:程序博客网 时间:2024/06/17 12:44

有时候不愿写Make 文件,

 

直接编译执行程序文件时常用的几个编译参数

 

#! /bin/bash

if [ $# -lt 1 ]; then
    echo usage: mcc file
    echo --$#-- permater error!!!!!
    exit -1
fi

echo compile  $1.c
echo Start! .............. 

gcc -I../include -Wall -ansi -pedantic -ggdb3 -o $1 ../lib/error_pro.o ../lib/get_sys_time.o  ../lib/file_operate.o ../lib/get_server_table.o ../lib/uftt.o $1.c

#gcc -I../include -Wall -ansi -pedantic -ggdb3 -o $1 ../lib/error_pro.o ../lib/get_sys_time.o  ../lib/file_operate.o ../lib/get_server_table.o  $1.c

echo End! ............... 
echo compile succeed!!!
cp $1 ../bin
ls -l ../bin/$1

 

 

或者编译.o文件

#! /bin/bash

if [ $# -lt 1 ]; then
    echo usage: mcc file
    echo --$#-- permater error!!!!!
    exit -1
fi

echo compile  $1.c
echo Start! .....................................

gcc -I../include -Wall -ansi -pedantic -ggdb3 -c $1.c

echo End! ....................................... 
echo compile succeed!!!
mv $1.o ../lib/.
ls -l ../lib/$1.o