Build Automation, Makefile

GNU Make 강좌
GNU Make 재컴파일을 지휘하는 프로그램(A Program for Directing Recompilation)

Makefile

#==========
# File Name     Makefile
#
# @version      1.0     Jan 03, 2010
# @revision     Mar 25, 2010
# @author       seokgu.bang
# @e-mail       
# @charset      UTF-8
#==========

#====================
# Macro Define
#====================

#==========
# Project Home
#==========
HOME=/export/home/proxies/programmingLanguage/proc/sam_rcv

#==========
# Bin Home
#==========
BIN_HOME=$(HOME)/bin

#==========
# Suffixes Rule
#==========
.SUFFIXES: .pc .c .o

#==========
# Pro*C/C++ Compile Option
#==========
PROC=proc
PROCFLAGS=parse=full dbms=v8 fips=none oraca=yes select_error=no \
        sqlcheck=full unsafe_null=yes userid=scott/tiger \
        ireclen=1024 oreclen=1024
#char_map=varchar2

PROCINCS=include=. \
    include=$(HOME)/include \
    include=${ORACLE_HOME}/precomp/public

#==========
# C Compile Option
#==========
# CC
#CC=cc
#CFLAGS= -Wl,+vnocompatwarnings # 링커에게 호환성 경고를 내지 않도록 한다.

# GNU Compiler Collection(GCC)
CC=gcc
CDEBUG= -g # Debugging Options
CFLAGS= -Wall # This enables all the warnings about constructions

# Common
INCS=-I$(HOME)/inc \
    -I${ORACLE_HOME}/precomp/public

# HP-UX 32bit
#LIBS=-L${ORACLE_HOME}/lib32 -lclntsh

# Solaris x86 32bit
# -lnsl: /usr/lib/libnsl
# -lsocket: /usr/lib/libsocket.so
# -laio: /usr/lib/libaio.so
# -lm:
LIBS=-L${ORACLE_HOME}/lib -lclntsh -lnsl -lsocket -laio -lm

TARGET= ora_conn \

#====================
# Command Define
#====================
all: $(TARGET)

#==========
# Oracle Connect
#==========
ora_conn: ora_conn.pc
    $(PROC) $(PROCFLAGS) ${PROCINC} iname=$(@:=.pc)
    $(CC) $(CFLAGS) -c -o $@.o $@.c $(INCS)
    $(CC) $(CFLAGS) -o $(BIN_HOME)/$@ $@.o $(LIBS)

clean:
    rm -f $(TARGET) *.lis *.c *.o core

참고 자료
GCC 4.5.0 manuals

Leave a Reply