2015-01-22 09:43:28 -05:00
|
|
|
# rules to build a program
|
2008-01-05 19:25:55 +00:00
|
|
|
# based on FreeBSD's bsd.prog.mk
|
|
|
|
|
2009-05-01 15:11:40 +01:00
|
|
|
# Copyright (c) 2008 Roy Marples <roy@marples.name>
|
2011-06-29 19:46:31 -04:00
|
|
|
# Released under the 2-clause BSD license.
|
2008-01-05 19:25:55 +00:00
|
|
|
|
|
|
|
OBJS+= ${SRCS:.c=.o}
|
|
|
|
|
2008-01-11 17:21:21 +00:00
|
|
|
# Some systems don't include /lib in their standard link path
|
|
|
|
# so we should embed it if different
|
2008-01-11 23:40:22 +00:00
|
|
|
# This is currently hardcoded for NetBSD which has two dynamic linkers
|
|
|
|
# and we need to use the one in /libexec instead of /usr/libexec
|
2008-03-02 10:40:08 +00:00
|
|
|
_DYNLINK_SH= if test "${PREFIX}" = "" && test -e /libexec/ld.elf_so; then \
|
2008-01-11 23:40:22 +00:00
|
|
|
echo "-Wl,-dynamic-linker=/libexec/ld.elf_so"; \
|
2008-01-18 11:26:23 +00:00
|
|
|
else \
|
|
|
|
echo ""; \
|
2008-01-11 17:21:21 +00:00
|
|
|
fi
|
2011-01-29 17:32:38 -06:00
|
|
|
_DYNLINK:= $(shell ${_DYNLINK_SH})
|
|
|
|
LDFLAGS+= ${_DYNLINK}
|
2009-05-02 18:29:00 +01:00
|
|
|
LDFLAGS+= -Wl,-rpath=${PREFIX}/${LIBNAME}
|
2008-01-11 17:21:21 +00:00
|
|
|
LDFLAGS+= ${PROGLDFLAGS}
|
|
|
|
|
2008-03-03 13:04:08 +00:00
|
|
|
CLEANFILES+= ${OBJS} ${PROG}
|
|
|
|
|
2008-01-07 14:20:13 +00:00
|
|
|
all: depend ${PROG}
|
2008-01-05 19:25:55 +00:00
|
|
|
|
2011-10-28 11:14:44 -05:00
|
|
|
%.o: %.c
|
2015-01-22 09:43:28 -05:00
|
|
|
${CC} ${LOCAL_CFLAGS} ${LOCAL_CPPFLAGS} ${CFLAGS} ${CPPFLAGS} -c $< -o $@
|
2008-06-19 23:12:00 +00:00
|
|
|
|
2008-01-05 19:25:55 +00:00
|
|
|
${PROG}: ${SCRIPTS} ${OBJS}
|
2015-01-22 09:43:28 -05:00
|
|
|
${CC} ${LOCAL_CFLAGS} ${LOCAL_LDFLAGS} ${CFLAGS} ${LDFLAGS} -o $@ ${OBJS} ${LDADD}
|
2008-01-05 19:25:55 +00:00
|
|
|
|
2008-01-09 11:44:43 +00:00
|
|
|
clean:
|
2008-03-03 13:04:08 +00:00
|
|
|
rm -f ${CLEANFILES}
|
2008-01-07 14:20:13 +00:00
|
|
|
|
2008-10-20 12:09:14 +00:00
|
|
|
extra_depend:
|
|
|
|
|
2008-03-19 15:22:20 +00:00
|
|
|
include ${MK}/sys.mk
|
|
|
|
include ${MK}/os.mk
|
2008-01-10 16:35:59 +00:00
|
|
|
include ${MK}/depend.mk
|
2009-04-30 15:05:39 +01:00
|
|
|
include ${MK}/gitignore.mk
|