libbsd/Makefile

73 lines
1.9 KiB
Makefile
Raw Normal View History

2005-07-24 23:35:23 +00:00
#
# libbsd
#
# $Id$
#
2006-08-25 13:39:32 +00:00
LIB_SRCS := arc4random.c bsd_getopt.c err.c fgetln.c heapsort.c \
2006-11-07 23:41:16 +00:00
linkaddr.c humanize_number.c inet_net_pton.c \
2006-03-19 10:25:49 +00:00
strlcat.c strlcpy.c md5c.c fmtcheck.c progname.c vis.c unvis.c
2006-02-14 05:39:29 +00:00
LIB_SRCS := $(patsubst %,src/%,$(LIB_SRCS))
2005-07-24 23:35:23 +00:00
2006-03-19 10:25:49 +00:00
LIB_INCLUDES := bsd/err.h bsd/getopt.h bsd/ip_icmp.h bsd/random.h bsd/queue.h bsd/md5.h bsd/string.h \
2006-11-07 23:41:16 +00:00
bsd/bsd.h bsd/cdefs.h bsd/stdlib.h bsd/if_dl.h vis.h libutil.h
2005-12-20 20:29:47 +00:00
LIB_MANS := arc4random.3 strlcpy.3 fgetln.3 fmtcheck.3
2006-02-14 05:33:38 +00:00
LIB_MANS := $(patsubst %,man/%,$(LIB_MANS))
2005-07-24 23:35:23 +00:00
LIB_STATIC_OBJS = $(LIB_SRCS:%.c=%.o)
LIB_SHARED_OBJS = $(LIB_SRCS:%.c=%.lo)
LIB_NAME = libbsd
LIB_VERSION_MAJOR = 0
LIB_VERSION_MINOR = 0
LIB_STATIC = $(LIB_NAME).a
LIB_SHARED_SO = $(LIB_NAME).so
LIB_SONAME = $(LIB_SHARED_SO).$(LIB_VERSION_MAJOR)
LIB_SHARED = $(LIB_SONAME).$(LIB_VERSION_MINOR)
2005-10-31 22:57:10 +00:00
MK_CFLAGS = -Iinclude/ -include bsd/bsd.h -D_GNU_SOURCE
2005-07-24 23:35:23 +00:00
libs: $(LIB_STATIC) $(LIB_SHARED_SO)
%.lo: %.c
$(CC) -o $@ $(MK_CFLAGS) $(CFLAGS) -DPIC -fPIC -c $<
%.o: %.c
$(CC) -o $@ $(MK_CFLAGS) $(CFLAGS) -c $<
$(LIB_STATIC): $(LIB_STATIC_OBJS)
ar rcs $@ $^
$(LIB_SHARED_SO): $(LIB_SONAME)
ln -fs $^ $@
$(LIB_SONAME): $(LIB_SHARED)
ln -fs $^ $@
$(LIB_SHARED): $(LIB_SHARED_OBJS)
2005-07-24 23:55:15 +00:00
gcc -shared \
-Wl,-soname -Wl,$(LIB_SONAME) \
-Wl,--version-script=Versions \
-o $@ $^
2005-07-24 23:35:23 +00:00
install: libs
mkdir -p $(DESTDIR)/usr/lib/ $(DESTDIR)/lib/
2005-07-24 23:35:23 +00:00
mkdir -p $(DESTDIR)/usr/include/bsd/
2005-12-20 20:29:47 +00:00
mkdir -p $(DESTDIR)/usr/share/man/man3
2005-07-24 23:35:23 +00:00
install -m644 $(LIB_STATIC) $(DESTDIR)/usr/lib/
install -m644 $(LIB_SHARED) $(DESTDIR)/lib/
for i in $(LIB_INCLUDES) ; do install -m644 include/$$i $(DESTDIR)/usr/include/$$i ; done
2005-12-20 21:05:34 +00:00
install -m644 $(LIB_MANS) $(DESTDIR)/usr/share/man/man3
ln -sf /lib/$(LIB_SHARED) $(DESTDIR)/usr/lib/$(LIB_SHARED_SO)
ln -sf $(LIB_SHARED) $(DESTDIR)/lib/$(LIB_SONAME)
2005-07-24 23:35:23 +00:00
clean:
rm -f $(LIB_STATIC_OBJS)
rm -f $(LIB_STATIC)
rm -f $(LIB_SHARED_OBJS)
rm -f $(LIB_SHARED) $(LIB_SONAME) $(LIB_SHARED_SO)
2005-07-24 22:51:34 +00:00