Browse Source

Attempt to make install work for mingw

signals
Gavin Howard 4 years ago
parent
commit
2bc50a9565
Signed by untrusted user who does not match committer: gavin
GPG Key ID: C08038BDF280D33E
  1. 8
      .gitignore
  2. 43
      Makefile
  3. 27
      install.sh
  4. 2
      tests/all.sh
  5. 2
      tests/bc/timeconst.sh
  6. 2
      tests/errors.sh
  7. 2
      tests/script.sh
  8. 2
      tests/scripts.sh
  9. 2
      tests/test.sh

8
.gitignore vendored

@ -3,10 +3,8 @@
*.files
*.includes
*.creator.user
bc
!bc/
dc
!dc/
bin/bc
bin/dc
*.o
*.a
.log_*.txt
@ -14,7 +12,7 @@ dc
.math.txt
.results.txt
.ops.txt
strgen
gen/strgen
lib.c
bc_help.c
dc_help.c

43
Makefile

@ -28,7 +28,9 @@ DC_ENABLED = DC_ENABLED
VERSION = 1.0
GEN_DIR = gen
GEN_EXEC = strgen
GEN = strgen
GEN_EXEC = $(GEN_DIR)/$(GEN)
GEN_C = $(GEN_DIR)/$(GEN).c
BC_LIB = $(GEN_DIR)/lib.bc
BC_LIB_C = $(GEN_DIR)/lib.c
@ -42,8 +44,12 @@ DC_HELP = $(GEN_DIR)/dc_help.txt
DC_HELP_C = $(GEN_DIR)/dc_help.c
DC_HELP_O = $(GEN_DIR)/dc_help.o
BC_EXEC = bc
DC_EXEC = dc
BIN = bin
BC = bc
DC = dc
BC_EXEC = $(BIN)/$(BC)
DC_EXEC = $(BIN)/$(DC)
PREFIX ?= /usr/local
@ -57,30 +63,33 @@ CPPFLAGS += -I./include/ -D_POSIX_C_SOURCE=200809L -DVERSION=$(VERSION)
HOSTCC ?= $(CC)
all: CPPFLAGS += -D$(DC_ENABLED) -D$(BC_ENABLED)
all: clean $(DC_HELP_O) $(BC_HELP_O) $(BC_LIB_O) $(BC_OBJ) $(DC_OBJ) $(OBJ)
all: make_bin clean $(DC_HELP_O) $(BC_HELP_O) $(BC_LIB_O) $(BC_OBJ) $(DC_OBJ) $(OBJ)
$(CC) $(CFLAGS) $(OBJ) $(DC_OBJ) $(BC_OBJ) $(BC_LIB_O) $(BC_HELP_O) $(DC_HELP_O) -o $(BC_EXEC)
ln -s ./$(BC_EXEC) $(DC_EXEC)
ln -s ./$(BC) $(DC_EXEC)
$(GEN_EXEC):
$(HOSTCC) -o $(GEN_EXEC) $(GEN_DIR)/$(GEN_EXEC).c
$(HOSTCC) -o $(GEN_EXEC) $(GEN_C)
$(BC_LIB_C): $(GEN_EXEC)
$(GEN_EMU) ./$(GEN_EXEC) $(BC_LIB) $(BC_LIB_C) bc_lib bc_lib_name $(BC_ENABLED)
$(GEN_EMU) $(GEN_EXEC) $(BC_LIB) $(BC_LIB_C) bc_lib bc_lib_name $(BC_ENABLED)
$(BC_HELP_C): $(GEN_EXEC)
$(GEN_EMU) ./$(GEN_EXEC) $(BC_HELP) $(BC_HELP_C) bc_help "" $(BC_ENABLED)
$(GEN_EMU) $(GEN_EXEC) $(BC_HELP) $(BC_HELP_C) bc_help "" $(BC_ENABLED)
$(DC_HELP_C): $(GEN_EXEC)
$(GEN_EMU) ./$(GEN_EXEC) $(DC_HELP) $(DC_HELP_C) dc_help "" $(DC_ENABLED)
$(GEN_EMU) $(GEN_EXEC) $(DC_HELP) $(DC_HELP_C) dc_help "" $(DC_ENABLED)
$(DC_EXEC): CPPFLAGS += -D$(DC_ENABLED)
$(DC_EXEC): clean $(DC_OBJ) $(DC_HELP_O) $(OBJ)
$(DC): CPPFLAGS += -D$(DC_ENABLED)
$(DC): make_bin clean $(DC_OBJ) $(DC_HELP_O) $(OBJ)
$(CC) $(CFLAGS) $(OBJ) $(DC_OBJ) $(DC_HELP_O) -o $(DC_EXEC)
$(BC_EXEC): CPPFLAGS += -D$(BC_ENABLED)
$(BC_EXEC): clean $(BC_OBJ) $(BC_LIB_O) $(BC_HELP_O) $(OBJ)
$(BC): CPPFLAGS += -D$(BC_ENABLED)
$(BC): make_bin clean $(BC_OBJ) $(BC_LIB_O) $(BC_HELP_O) $(OBJ)
$(CC) $(CFLAGS) $(OBJ) $(BC_OBJ) $(BC_LIB_O) $(BC_HELP_O) -o $(BC_EXEC)
make_bin:
mkdir -p $(BIN)
help:
@echo "all targets use config.mak, if there is one"
@echo ""
@ -167,11 +176,11 @@ clean_tests: clean
$(RM) -f .math.txt .results.txt .ops.txt
$(RM) -f .test.txt
install: uninstall
$(INSTALL) $(DESTDIR)$(PREFIX)/bin $(BC_EXEC) $(DC_EXEC)
install:
$(INSTALL) $(DESTDIR)$(PREFIX)/$(BIN) $(BIN)
uninstall:
$(RM) -f $(DESTDIR)$(PREFIX)/bin/$(BC_EXEC)
$(RM) -f $(DESTDIR)$(PREFIX)/bin/$(DC_EXEC)
$(RM) -f $(DESTDIR)$(PREFIX)/$(BC_EXEC)
$(RM) -f $(DESTDIR)$(PREFIX)/$(DC_EXEC)
.PHONY: help clean clean_tests install uninstall test

27
install.sh

@ -15,7 +15,7 @@
#
usage() {
printf "usage: %s install_dir executable [symlinks...]\n" "$0" 1>&2
printf "usage: %s install_dir bin_dir\n" "$0" 1>&2
exit 1
}
@ -29,24 +29,21 @@ test "$#" -gt 1 || usage
installdir="$1"
shift
exe="$1"
bindir="$1"
shift
while [ ! -f "$exe" ]; do
exe="$1"
shift
done
"$INSTALL" -Dm 755 "$exe" "$installdir/$exe"
while [ $# -gt 0 ]; do
cd "$bindir"
link="$1"
shift
for exe in ./*; do
base=$(basename "$link")
base=$(basename "$exe")
rm -f "$installdir/$base"
ln -s "./$exe" "$installdir/$base"
if [ -L "$exe" ]; then
L=$(ls -dl "$exe")
link=$(echo ${L#*-> })
"$INSTALL" -Dlm 755 "$link" "$installdir/$base"
else
"$INSTALL" -Dm 755 "$exe" "$installdir/$base"
fi
done

2
tests/all.sh

@ -29,7 +29,7 @@ else
fi
if [ "$#" -lt 1 ]; then
exe="$testdir/../$d"
exe="$testdir/../bin/$d"
else
exe="$1"
fi

2
tests/bc/timeconst.sh

@ -35,7 +35,7 @@ if [ "$#" -gt 0 ]; then
bc="$1"
shift
else
bc="$testdir/../../bc"
bc="$testdir/../../bin/bc"
fi
out1="$testdir/../.log_bc.txt"

2
tests/errors.sh

@ -90,7 +90,7 @@ else
fi
if [ "$#" -lt 1 ]; then
exe="$testdir/../$d"
exe="$testdir/../bin/$d"
else
exe="$1"
shift

2
tests/script.sh

@ -27,7 +27,7 @@ script="$1"
shift
if [ "$#" -lt 1 ]; then
bc="$testdir/../bc"
bc="$testdir/../bin/bc"
else
bc="$1"
fi

2
tests/scripts.sh

@ -32,7 +32,7 @@ if [ "$#" -gt 0 ]; then
exe="$1"
shift
else
exe="$testdir/../$d"
exe="$testdir/../bin/$d"
fi
out1="$testdir/../.log_bc.txt"

2
tests/test.sh

@ -41,7 +41,7 @@ if [ "$#" -gt 0 ]; then
exe="$1"
shift
else
exe="$testdir/../$d"
exe="$testdir/../bin/$d"
fi
out="$testdir/../.log_test.txt"

Loading…
Cancel
Save