C언어

apr Makefile 만들기

고요한하늘... 2009. 1. 22. 15:41

APR-1.3.3 경로 설정 : APR-1.3.3=XXXX/apr-1.3.3

ARP-UTIL 경로 설정 : APR-UTIL=XXXX/apr-util-1.3.4

APR-1.3.3.CONF 경로 : APR-1.3.3=XXXX/apr-1.3.3/apr-1-config 

ARP-UTIL.CONF 경로 설정 : APR-UTIL=XXXX/apr-util-1.3.4/apu-1-config

 

header file 경로 :  INCS=$(shell $(APR-1.3.3.CONF) --includes ) $(shell $(ARP-UTIL.CONF) --includes )

lib file 경로 및 이름:  LDLIBS= $(shell $(APR-1.3.3.CONF) --link-ld --libs ) $(shell $(ARP-UTIL.CONF) --link-ld --libs)

 

test : test.o
    $(CC) -o $@ $^ $(LDLIBS) -L/usr/local/apr/lib


.c.o:
    $(CC) -c  $(CFLAGS) ./$(<F) -o $(@F) -I$(INCS)

clean :
    rm -f *.o test
 

 

 

apr(apu)-1-config 내부 옵션 :  

  --prefix[=DIR]    change prefix to DIR
  --bindir          print location where binaries are installed
  --includedir      print location where headers are installed
  --cc              print C compiler name
  --cpp             print C preprocessor name and any required options
  --cflags          print C compiler flags
  --cppflags        print C preprocessor flags
  --includes        print include information
  --ldflags         print linker flags
  --libs            print additional libraries to link against
  --srcdir          print APR source directory
  --installbuilddir print APR build helper directory
  --link-ld         print link switch(es) for linking to APR
  --link-libtool    print the libtool inputs for linking to APR
  --shlib-path-var  print the name of the shared library path env var
  --apr-la-file     print the path to the .la file, if available
  --apr-so-ext      print the extensions of shared objects on this platform
  --apr-lib-target  print the libtool target information
  --apr-libtool     print the path to APR's libtool
  --version         print the APR's version as a dotted triple
  --help            print this help

 

example>

 

CC=gcc
CFLAGS=-g -o

program=apr_pool apr_userdata apr_parent apr_env apr_so apr_passwd apr_getname apr_time apr_server apr_client

all : $(program)
apr_pool : apr_pool.c
    $(CC) $(CFLAGS) $@ $<   -I/usr/local/apr/include/apr-1 -L/usr/local/apr/lib -lapr-1 -DLINUX=2 -D_REENTRANT -D_GNU_SOURCE -D_LARGEFILE64_SOURCE

apr_userdata : apr_userdata.c
    $(CC) $(CFLAGS) $@ $<   -I/usr/local/apr/include/apr-1 -L/usr/local/apr/lib -lapr-1 -DLINUX=2 -D_REENTRANT -D_GNU_SOURCE -D_LARGEFILE64_SOURCE

apr_parent : apr_parent.c
    $(CC) $(CFLAGS) $@ $<   -I/usr/local/apr/include/apr-1 -L/usr/local/apr/lib -lapr-1 -DLINUX=2 -D_REENTRANT -D_GNU_SOURCE -D_LARGEFILE64_SOURCE

apr_env : apr_env.c
    $(CC) $(CFLAGS) $@ $<   -I/usr/local/apr/include/apr-1 -L/usr/local/apr/lib -lapr-1 -DLINUX=2 -D_REENTRANT -D_GNU_SOURCE -D_LARGEFILE64_SOURCE

apr_so : apr_so.c
    $(CC) $(CFLAGS) $@ $<   -I/usr/local/apr/include/apr-1 -L/usr/local/apr/lib -lapr-1 -DLINUX=2 -D_REENTRANT -D_GNU_SOURCE -D_LARGEFILE64_SOURCE -ldl

apr_passwd : apr_passwd.c
    $(CC) $(CFLAGS) $@ $<   -I/usr/local/apr/include/apr-1 -L/usr/local/apr/lib -lapr-1 -DLINUX=2 -D_REENTRANT -D_GNU_SOURCE -D_LARGEFILE64_SOURCE

apr_getname : apr_getname.c
    $(CC) $(CFLAGS) $@ $<   -I/usr/local/apr/include/apr-1 -L/usr/local/apr/lib -lapr-1 -DLINUX=2 -D_REENTRANT -D_GNU_SOURCE -D_LARGEFILE64_SOURCE

apr_time : apr_time.c
    $(CC) $(CFLAGS) $@ $<   -I/usr/local/apr/include/apr-1 -L/usr/local/apr/lib -lapr-1 -DLINUX=2 -D_REENTRANT -D_GNU_SOURCE -D_LARGEFILE64_SOURCE

apr_server : apr_server.c
    $(CC) $(CFLAGS) $@ $<   -I/usr/local/apr/include/apr-1 -L/usr/local/apr/lib -lapr-1 -DLINUX=2 -D_REENTRANT -D_GNU_SOURCE -D_LARGEFILE64_SOURCE

apr_client : apr_client.c
    $(CC) $(CFLAGS) $@ $<   -I/usr/local/apr/include/apr-1 -L/usr/local/apr/lib -lapr-1 -DLINUX=2 -D_REENTRANT -D_GNU_SOURCE -D_LARGEFILE64_SOURCE

clean :
    rm -f $(program)

'C언어' 카테고리의 다른 글

[APR] memory pool  (0) 2009.01.22
apache 코어 설정  (0) 2009.01.22
Apache Portable Runtime 설치  (0) 2009.01.19
분산 처리( distributed processing )  (0) 2009.01.06
내가 해보고 싶은 분산 컴퓨팅  (0) 2008.12.12