11
Makefile
- #
- COMPONENT = mb
- VERSION = 2.0
- REVISION = 1
- DISTRIB = $(COMPONENT)-$(VERSION)-$(REVISION)
- TARGET = $(LIB_FILES) $(ETC_FILES)
- INCS = -I/usr/local/include
- CC = gcc $(INCS) -DLINUX
- # CC = gcc $(INCS) -DSUN
- # CC = cc -Ae -DHPUX $(INCS)
- LD = gcc -s
- # CFLAGS = -g -DDEBUG
- CFLAGS = -DDEBUG -Wall -O -fstrength-reduce -finline-functions -fomit-frame-pointer
- # CFLAGS = -DDEBUG -O
- LIB_SRCS = mb_api.c mb_sio.c
- LIB_OBJS = $(LIB_SRCS:.c=.o)
- MBD_SRCS = mbd.c mbd_kbd.c
- MBD_OBJS = $(MBD_SRCS:.c=.o)
- MBPING_SRCS = mbping.c mbping_kbd.c
- MBPING_OBJS = $(MBPING_SRCS:.c=.o)
- MBEXP_SRCS = mbexp.c
- MBEXP_OBJS = $(MBEXP_SRCS:.c=.o)
- LIBSYS =
- # LIBSYS = -lsocket -lnsl
- LIBCTK = -lctk
- # LIBCTK = -lctk -L/usr/local/lib -lctk
- INC_FILES = mb.h
- LIB_FILES = libmb.a
- ETC_FILES = mbd mbping
- EXP_FILES = mbexp.c
- LICENSE_FILE = LICENSE
- INSTALL = /usr/bin/install
- INSTALL_DIR = /usr/local
- DISTRIB_DIR = $(DISTRIB)
- DISTRIB_FILES = $(LICENSE_FILE) $(INC_FILES) $(LIB_FILES) $(ETC_FILES) $(EXP_FILES)
- SOURCE_FILES = $(LICENSE_FILE) Makefile Makefile.distrib *.[ch]
- SOURCE_DIR = $(COMPONENT)
- SOURCE_TAPE = $(SOURCE_DIR).tar
- .SILENT:
- project: $(TARGET)
- libmb.a: $(LIB_OBJS)
- ar rc $@ $?
- ranlib $@
- mbd: libmb.a $(MBD_OBJS)
- $(LD) $(MBD_OBJS) libmb.a $(LIBCTK) $(LIBSYS) -o $@
- mbping: libmb.a $(MBPING_OBJS)
- $(LD) $(MBPING_OBJS) libmb.a $(LIBCTK) $(LIBSYS) -o $@
- mbexp: libmb.a mbexp.o
- $(LD) mbexp.o libmb.a $(LIBSYS) -o $@
- proto:
- prototype $(LIB_SRCS) $(MBD_SRCS) $(MBPING_SRCS)
- clean:
- rm -fr $(SOURCE_DIR) $(DISTRIB_DIR) $(TARGET) distrib mbexp core *.o a.out
- 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 f in $(DISTRIB_FILES); do ln -s ../$$f .; done)
- rm -f distrib
- ln -s $(DISTRIB_DIR) distrib
- echo [Building $(DISTRIB_DIR)/Makefile]
- 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
- distrib::
- (cd $(DISTRIB_DIR); make distrib)
- zip::
- echo [Building $(COMPONENT).tar.gz]
- rm -fr $(SOURCE_DIR)
- mkdir $(SOURCE_DIR)
- (cd $(SOURCE_DIR); for f in $(SOURCE_FILES); do ln -s ../$$f .; done)
- zip::
- tar -zchf $(SOURCE_TAPE).gz $(SOURCE_DIR)
- #
- mbd.c mbping.c: mbdef.h
- mbd.c: mbd.h
Comments