12
Makefile
- COMPONENT = ctk
- VERSION = 2.0
- REVISION = 1
- TARGET = $(CTK_LIB)
- CC = gcc
- LD = gcc -s
- # CFLAGS = -g -DDEBUG
- CFLAGS = -Wall -O -fstrength-reduce -finline-functions -fomit-frame-pointer
- CTK_SRCS = list.c shell.c task.c scheduler.c dump.c
- CTK_OBJS = $(CTK_SRCS:.c=.o)
- CTK_LIB = lib$(COMPONENT).a
- INC_FILES = list.h shell.h task.h scheduler.h dump.h debug.h
- LIB_FILES = $(CTK_LIB)
- LICENSE_FILE = LICENSE
- SAMPLE_FILE = tictac.c
- INSTALL = install
- INSTALL_DIR = /usr/local
- DISTRIB_DIR = $(COMPONENT)-$(VERSION)-$(REVISION)
- DISTRIB_FILES = $(LICENSE_FILE) $(INC_FILES) $(LIB_FILES) $(SAMPLE_FILE)
- TAR_FILES = $(LICENSE_FILE) $(INC_FILES) $(CTK_SRCS) $(SAMPLE_FILE) prototype Makefile Makefile.distrib
- #.SILENT:
- project: $(TARGET)
- .c.o:
- $(CC) $(CFLAGS) -c $<
- $(CTK_LIB): $(CTK_OBJS)
- ar rc $@ $?
- proto:
- ./prototype $(CTK_SRCS)
- clean:
- rm -fr $(DISTRIB_DIR) $(TARGET) tictac test-* T core *.o *.exe *~
- wipe: clean
- rm -f *.tar.gz
- install: distrib
- (cd $(DISTRIB_DIR); make install)
- distrib:: $(TARGET)
- echo [Building $(DISTRIB_DIR)]
- rm -fr $(DISTRIB_DIR)
- mkdir $(DISTRIB_DIR)
- (cd $(DISTRIB_DIR); for n in $(DISTRIB_FILES); do ln -s ../$$n .; done)
- echo [Building $(DISTRIB_DIR)/Makefile]
- 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
- distrib::
- (cd $(DISTRIB_DIR); make distrib)
- tar:
- tar -zcf $(COMPONENT).tar.gz $(TAR_FILES)
- #
- test: test-dump test-shell
- test-dir:
- if [ ! -d T ]; then mkdir T; fi
- test-dump: test-dir T/dump.o
- $(CC) T/dump.o -o $@
- T/dump.o: dump.c
- $(CC) $(CFLAGS) -DDEBUG -DSTANDALONE -c dump.c -o $@
- test-shell: test-dir T/shell.o list.o
- $(CC) T/shell.o list.o -o $@ -lreadline
- T/shell.o: shell.c
- $(CC) $(CFLAGS) -DDEBUG -DSTANDALONE -c shell.c -o $@
- tictac: $(CTK_LIB) tictac.o
- $(CC) tictac.o -o $@ $(CTK_LIB) -lreadline
Comments