7

Makefile

  1. #
  2.  
  3.       COMPONENT = mb
  4.         VERSION = 2.0
  5.        REVISION = 1
  6.  
  7.         DISTRIB = $(COMPONENT)-$(VERSION)-$(REVISION)
  8.  
  9.          TARGET = $(LIB_FILES) $(ETC_FILES)
  10.  
  11.            INCS = -I/usr/local/include
  12.  
  13.              CC = gcc $(INCS) -DLINUX
  14. #            CC = gcc $(INCS) -DSUN
  15. #            CC = cc -Ae -DHPUX $(INCS)
  16.  
  17.              LD = gcc -s
  18.  
  19. #        CFLAGS = -g -DDEBUG
  20.          CFLAGS = -DDEBUG -Wall -O -fstrength-reduce -finline-functions -fomit-frame-pointer
  21. #        CFLAGS = -DDEBUG -O
  22.  
  23.        LIB_SRCS = mb_api.c mb_sio.c
  24.        LIB_OBJS = $(LIB_SRCS:.c=.o)
  25.  
  26.        MBD_SRCS = mbd.c mbd_kbd.c
  27.        MBD_OBJS = $(MBD_SRCS:.c=.o)
  28.  
  29.     MBPING_SRCS = mbping.c mbping_kbd.c
  30.     MBPING_OBJS = $(MBPING_SRCS:.c=.o)
  31.  
  32.      MBEXP_SRCS = mbexp.c
  33.      MBEXP_OBJS = $(MBEXP_SRCS:.c=.o)
  34.  
  35.          LIBSYS =
  36. #        LIBSYS = -lsocket -lnsl
  37.          LIBCTK = -lctk
  38. #        LIBCTK = -lctk -L/usr/local/lib -lctk
  39.  
  40.       INC_FILES = mb.h
  41.       LIB_FILES = libmb.a
  42.       ETC_FILES = mbd mbping
  43.       EXP_FILES = mbexp.c
  44.  
  45.    LICENSE_FILE = LICENSE
  46.         INSTALL = /usr/bin/install
  47.     INSTALL_DIR = /usr/local
  48.     DISTRIB_DIR = $(DISTRIB)
  49.   DISTRIB_FILES = $(LICENSE_FILE) $(INC_FILES) $(LIB_FILES) $(ETC_FILES) $(EXP_FILES)
  50.    SOURCE_FILES = $(LICENSE_FILE) Makefile Makefile.distrib *.[ch]
  51.      SOURCE_DIR = $(COMPONENT)
  52.     SOURCE_TAPE = $(SOURCE_DIR).tar
  53.  
  54. .SILENT:
  55.  
  56. project:    $(TARGET)
  57.  
  58. libmb.a:    $(LIB_OBJS)
  59.     ar rc $@ $?
  60.     ranlib $@
  61.  
  62. mbd:        libmb.a $(MBD_OBJS)
  63.     $(LD) $(MBD_OBJS) libmb.a $(LIBCTK) $(LIBSYS) -o $@
  64.  
  65. mbping:     libmb.a $(MBPING_OBJS)
  66.     $(LD) $(MBPING_OBJS) libmb.a $(LIBCTK) $(LIBSYS) -o $@
  67.  
  68. mbexp:  libmb.a mbexp.o
  69.     $(LD) mbexp.o libmb.a $(LIBSYS) -o $@
  70.  
  71. proto:
  72.     prototype $(LIB_SRCS) $(MBD_SRCS) $(MBPING_SRCS)
  73.  
  74. clean:
  75.     rm -fr $(SOURCE_DIR) $(DISTRIB_DIR) $(TARGET) distrib mbexp core *.o a.out
  76.  
  77. wipe:   clean
  78.     rm -f *.tar.gz
  79.  
  80. install:    distrib
  81.     (cd $(DISTRIB_DIR); make install)
  82.  
  83. distrib::       $(TARGET)
  84.     echo [Building $(DISTRIB_DIR)]
  85.     rm -fr $(DISTRIB_DIR)
  86.     mkdir $(DISTRIB_DIR)
  87.     (cd $(DISTRIB_DIR); for f in $(DISTRIB_FILES); do ln -s ../$$f .; done)
  88.     rm -f distrib
  89.     ln -s $(DISTRIB_DIR) distrib
  90.  
  91.     echo [Building $(DISTRIB_DIR)/Makefile]
  92.     sed 's,@COMPONENT@,$(COMPONENT),;s,@VERSION@,$(VERSION),;s,@REVISION@,$(REVISION),;s,@INC_FILES@,$(INC_FILES),;s,@LIB_FILES@,$(LIB_FILES),;s,@ETC_FILES@,$(ETC_FILES),;s,@INSTALL@,$(INSTALL),;s,@INSTALL_DIR@,$(INSTALL_DIR),' Makefile.distrib > $(DISTRIB_DIR)/Makefile
  93.  
  94. distrib::
  95.     (cd $(DISTRIB_DIR); make distrib)
  96.  
  97. zip::
  98.     echo [Building $(COMPONENT).tar.gz]
  99.     rm -fr $(SOURCE_DIR)
  100.     mkdir $(SOURCE_DIR)
  101.     (cd $(SOURCE_DIR); for f in $(SOURCE_FILES); do ln -s ../$$f .; done)
  102.    
  103. zip::
  104.     tar -zchf $(SOURCE_TAPE).gz $(SOURCE_DIR)
  105.    
  106. #
  107. mbd.c mbping.c: mbdef.h
  108. mbd.c:  mbd.h

Comments

Your comment:
[p] [b] [i] [u] [s] [quote] [pre] [br] [code] [url] [email] strip help 2000

Enter a maximum of 2000 characters.
Improve the presentation of your text with the following formatting tags:
[p]paragraph[/p], [b]bold[/b], [i]italics[/i], [u]underline[/u], [s]strike[/s], [quote]citation[/quote], [pre]as is[/pre], [br]line break,
[url]http://www.izend.org[/url], [url=http://www.izend.org]site[/url], [email]izend@izend.org[/email], [email=izend@izend.org]izend[/email],
[code]command[/code], [code=language]source code in c, java, php, html, javascript, xml, css, sql, bash, dos, make, etc.[/code].