update yap
This commit is contained in:
parent
b6a3e7f39f
commit
e5c8790d7b
|
@ -6,6 +6,33 @@ if which gcc > /dev/null; then
|
|||
cc=gcc # default to gcc. we're using its options after all
|
||||
fi
|
||||
|
||||
# remove all -arch <whatever> directives save the first.
|
||||
#
|
||||
# We should not be doing this. Instead, we should collect the dependencies for every arch
|
||||
# independently and then union the results. However, the prospect of doing that in POSIX sh fills me
|
||||
# with despair.
|
||||
found_arch=false
|
||||
nargs=$#
|
||||
i=0
|
||||
while [ $i -ne $nargs ]; do
|
||||
i=$((i + 1))
|
||||
save="$1"
|
||||
shift
|
||||
if [ "$save" = "-arch" ] ; then
|
||||
if $found_arch ; then
|
||||
# found -arch already. Snarf this and the next arg.
|
||||
i=$((i + 1))
|
||||
shift
|
||||
else
|
||||
# let the first -arch slide. Next iteration will handle the arch option itself.
|
||||
set -- "$@" "$save"
|
||||
found_arch=true
|
||||
fi
|
||||
else
|
||||
set -- "$@" "$save"
|
||||
fi
|
||||
done
|
||||
|
||||
DIR="$1"
|
||||
shift 1
|
||||
case "$DIR" in
|
||||
|
@ -13,7 +40,7 @@ case "$DIR" in
|
|||
$cc -MM -MG -DDEPEND_ANALYSIS "$@" | sed -e 's@^\(.*\)\.o:@\1.d \1.o:@'
|
||||
;;
|
||||
*)
|
||||
ESCAPEDDIR=$(echo $DIR | sed -e 's/\//\\\//' 2>&1)
|
||||
ESCAPEDDIR=$(echo $DIR | sed -e 's/\//\\\//g' 2>&1)
|
||||
$cc -MM -MG -DDEPEND_ANALYSIS "$@" | sed -e "s/^\(.*\)\.o:/$ESCAPEDDIR\/\1.d $ESCAPEDDIR\/\1.o:/"
|
||||
;;
|
||||
esac
|
||||
|
|
|
@ -52,7 +52,10 @@ main_sane ()
|
|||
set -- "-m" "$mode" "$@"
|
||||
fi
|
||||
if [ $verbose != 0 ]; then
|
||||
set -- "-v" "$@"
|
||||
# Not all BSD install(1) implementations support verbose mode. For now special case NetBSD.
|
||||
if ! [ "$is_netbsd" = 1 ] ; then
|
||||
set -- "-v" "$@"
|
||||
fi
|
||||
fi
|
||||
invoke_install "$@"
|
||||
exit $?
|
||||
|
@ -132,7 +135,17 @@ elif [ $op = file ]; then
|
|||
fi
|
||||
fi
|
||||
|
||||
if uname | grep SunOS > /dev/null ; then
|
||||
case `uname` in
|
||||
*SunOS*)
|
||||
is_sunos=1
|
||||
;;
|
||||
*NetBSD*)
|
||||
is_netbsd=1
|
||||
;;
|
||||
esac
|
||||
|
||||
|
||||
if [ "$is_sunos" = 1 ] ; then
|
||||
main_sunos "$@"
|
||||
else
|
||||
main_sane "$@"
|
||||
|
|
17
yap/link.sh
17
yap/link.sh
|
@ -99,12 +99,22 @@ add_dl_links()
|
|||
fi
|
||||
}
|
||||
|
||||
add_curses_links()
|
||||
{
|
||||
if [ $uname_s = Linux ]; then
|
||||
append_element_to_quoted_array "$1" "$2" "-lncursesw"
|
||||
else
|
||||
append_element_to_quoted_array "$1" "$2" "-lncurses"
|
||||
fi
|
||||
}
|
||||
|
||||
driver=cc
|
||||
dynamic_install_name=""
|
||||
link_prefix=""
|
||||
uses_stdthreads=false
|
||||
uses_sockets=false
|
||||
uses_dl=false
|
||||
uses_curses=false
|
||||
|
||||
#parse script options.
|
||||
while true; do
|
||||
|
@ -127,6 +137,9 @@ while true; do
|
|||
--dl)
|
||||
uses_dl=true
|
||||
;;
|
||||
--curses)
|
||||
uses_curses=true
|
||||
;;
|
||||
--)
|
||||
shift
|
||||
break
|
||||
|
@ -166,6 +179,10 @@ if $uses_dl; then
|
|||
add_dl_links linker_arglist "${linker_arglist}"
|
||||
fi
|
||||
|
||||
if $uses_curses; then
|
||||
add_curses_links linker_arglist "${linker_arglist}"
|
||||
fi
|
||||
|
||||
# iterate argument list looking for -L flags.
|
||||
while true; do
|
||||
link=""
|
||||
|
|
|
@ -15,6 +15,12 @@ YAP_LINK := ./yap/link.sh
|
|||
YAP_GENERATE_DYLIBNAME := ./yap/generate_dylibname.sh
|
||||
YAP_UNAME_S := $(shell uname -s)
|
||||
|
||||
ifdef PLATFORM
|
||||
YAP_PLATFORM_SUFFIX := -$(PLATFORM)
|
||||
else
|
||||
YAP_PLATFORM_SUFFIX :=
|
||||
endif
|
||||
|
||||
ifeq ($(shell uname),SunOS)
|
||||
CC=gcc
|
||||
endif
|
||||
|
@ -23,8 +29,10 @@ YAP_IS_GCC := $(shell ($(CC) --version | grep 'Copyright.*Free Software Foundati
|
|||
|
||||
# set default flags.
|
||||
|
||||
CXXFLAGS += -std=c++17 -Wall
|
||||
CFLAGS += -std=c11 -Wall
|
||||
CXXFLAGS += -std=c++17 -Wall
|
||||
CFLAGS += -I.
|
||||
CXXFLAGS += -I.
|
||||
CFLAGS += $(patsubst %,-I%,$(MODULES))
|
||||
CXXFLAGS += $(patsubst %,-I%,$(MODULES))
|
||||
CFLAGS += $(patsubst %,-I%/public_headers,$(MODULES))
|
||||
|
@ -32,16 +40,21 @@ CXXFLAGS += $(patsubst %,-I%/public_headers,$(MODULES))
|
|||
|
||||
# define recipes for depend files.
|
||||
|
||||
%.d: %.c
|
||||
%$(YAP_PLATFORM_SUFFIX).d: %.c
|
||||
./yap/depend.sh `dirname $*.c` $(CFLAGS) $*.c > $@
|
||||
|
||||
%.d: %.cc
|
||||
%$(YAP_PLATFORM_SUFFIX).d: %.cc
|
||||
./yap/depend.sh `dirname $*.cc` $(CXXFLAGS) $*.cc > $@
|
||||
|
||||
# define filelist variables for modules to add to.
|
||||
|
||||
ALLOBJ = $(patsubst %.c,%.o,$(filter %.c,$(CSRC)))
|
||||
ALLOBJ += $(patsubst %.cc,%.o,$(filter %.cc,$(CPPSRC)))
|
||||
BUILD_ALLOBJ = $(patsubst %.c,%.o,$(filter %.c,$(CSRC)))
|
||||
BUILD_ALLOBJ += $(patsubst %.cc,%.o,$(filter %.cc,$(CPPSRC)))
|
||||
ifdef PLATFORM
|
||||
ALLOBJ = $(BUILD_ALLOBJ:.o=-$(PLATFORM).o)
|
||||
else
|
||||
ALLOBJ = $(BUILD_ALLOBJ)
|
||||
endif
|
||||
ALLDEPEND = $(ALLOBJ:.o=.d)
|
||||
|
||||
# include configuration.
|
||||
|
@ -51,6 +64,12 @@ ifndef PREFIX
|
|||
$(error PREFIX must be set via configuration.mk, even if to /)
|
||||
endif
|
||||
|
||||
ifdef DSTROOT
|
||||
DSTROOT_AND_PREFIX := $(DSTROOT)$(PREFIX)
|
||||
else
|
||||
DSTROOT_AND_PREFIX := $(PREFIX)
|
||||
endif
|
||||
|
||||
# include the project's modules, and then the defined depend files.
|
||||
|
||||
include $(MODULES:=/module.mk)
|
||||
|
@ -71,10 +90,32 @@ clean_alldepend:
|
|||
|
||||
clean: clean_allobj clean_alldepend
|
||||
|
||||
$(PREFIX)/bin:
|
||||
$(YAP_INSTALL) -d $@
|
||||
|
||||
$(PREFIX)/sbin:
|
||||
$(YAP_INSTALL) -d $@
|
||||
|
||||
$(PREFIX)/lib:
|
||||
$(YAP_INSTALL) -d $(PREFIX)/lib
|
||||
|
||||
$(PREFIX)/include:
|
||||
$(YAP_INSTALL) -d $(PREFIX)/include
|
||||
|
||||
ifdef DSTROOT
|
||||
$(DSTROOT_AND_PREFIX)/bin:
|
||||
$(YAP_INSTALL) -d $@
|
||||
|
||||
$(DSTROOT_AND_PREFIX)/sbin:
|
||||
$(YAP_INSTALL) -d $@
|
||||
|
||||
$(DSTROOT_AND_PREFIX)/lib:
|
||||
$(YAP_INSTALL) -d $(DSTROOT_AND_PREFIX)/lib
|
||||
|
||||
$(DSTROOT_AND_PREFIX)/include:
|
||||
$(YAP_INSTALL) -d $(DSTROOT_AND_PREFIX)/include
|
||||
endif
|
||||
|
||||
install: dstroot_install
|
||||
|
||||
.DEFAULT_GOAL := all
|
||||
|
|
Loading…
Reference in New Issue