10

Makefile

  1.       COMPONENT = ctk
  2.         VERSION = 2.0
  3.        REVISION = 1
  4.  
  5.          TARGET = $(CTK_LIB)
  6.  
  7.              CC = gcc
  8.              LD = gcc -s
  9.  
  10. #        CFLAGS = -g -DDEBUG
  11.          CFLAGS = -Wall -O -fstrength-reduce -finline-functions -fomit-frame-pointer
  12.        
  13.        CTK_SRCS = list.c shell.c task.c scheduler.c dump.c
  14.        CTK_OBJS = $(CTK_SRCS:.c=.o)
  15.  
  16.         CTK_LIB = lib$(COMPONENT).a
  17.  
  18.       INC_FILES = list.h shell.h task.h scheduler.h dump.h debug.h
  19.       LIB_FILES = $(CTK_LIB)
  20.  
  21.    LICENSE_FILE = LICENSE
  22.     SAMPLE_FILE = tictac.c
  23.  
  24.         INSTALL = install
  25.     INSTALL_DIR = /usr/local
  26.     DISTRIB_DIR = $(COMPONENT)-$(VERSION)-$(REVISION)
  27.   DISTRIB_FILES = $(LICENSE_FILE) $(INC_FILES) $(LIB_FILES) $(SAMPLE_FILE)
  28.  
  29.       TAR_FILES = $(LICENSE_FILE) $(INC_FILES) $(CTK_SRCS) $(SAMPLE_FILE) prototype Makefile Makefile.distrib
  30.  
  31. #.SILENT:
  32.  
  33. project:    $(TARGET)
  34.  
  35. .c.o:
  36.     $(CC) $(CFLAGS) -c $<
  37.  
  38. $(CTK_LIB): $(CTK_OBJS)
  39.     ar rc $@ $?
  40.  
  41. proto:
  42.     ./prototype $(CTK_SRCS)
  43. clean:
  44.     rm -fr $(DISTRIB_DIR) $(TARGET) tictac test-* T core *.o *.exe *~
  45.  
  46. wipe:   clean
  47.     rm -f *.tar.gz
  48.  
  49. install:    distrib
  50.     (cd $(DISTRIB_DIR); make install)
  51.  
  52. distrib::       $(TARGET)
  53.     echo [Building $(DISTRIB_DIR)]
  54.     rm -fr $(DISTRIB_DIR)
  55.     mkdir $(DISTRIB_DIR)
  56.     (cd $(DISTRIB_DIR); for n in $(DISTRIB_FILES); do ln -s ../$$n .; done)
  57.  
  58.     echo [Building $(DISTRIB_DIR)/Makefile]
  59.     sed 's,@COMPONENT@,$(COMPONENT),;s,@VERSION@,$(VERSION),;s,@INC_FILES@,$(INC_FILES),;s,@LIB_FILES@,$(LIB_FILES),;s,@INSTALL@,$(INSTALL),;s,@INSTALL_DIR@,$(INSTALL_DIR),' Makefile.distrib > $(DISTRIB_DIR)/Makefile
  60.  
  61. distrib::
  62.     (cd $(DISTRIB_DIR); make distrib)
  63.  
  64. tar:
  65.     tar -zcf $(COMPONENT).tar.gz $(TAR_FILES)
  66.  
  67. #
  68. test:       test-dump test-shell
  69.  
  70. test-dir:
  71.     if [ ! -d T ]; then mkdir T; fi
  72.  
  73. test-dump:  test-dir T/dump.o
  74.     $(CC) T/dump.o -o $@
  75. T/dump.o:   dump.c
  76.     $(CC) $(CFLAGS) -DDEBUG -DSTANDALONE -c dump.c -o $@
  77.  
  78. test-shell: test-dir T/shell.o list.o
  79.     $(CC) T/shell.o list.o -o $@ -lreadline
  80. T/shell.o:  shell.c
  81.     $(CC) $(CFLAGS) -DDEBUG -DSTANDALONE -c shell.c -o $@
  82.  
  83. tictac:     $(CTK_LIB) tictac.o
  84.     $(CC) tictac.o -o $@ $(CTK_LIB) -lreadline

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].