Attempt to make install work for mingw
diff --git a/.gitignore b/.gitignore
index ca4e615..448a9e0 100644
--- a/.gitignore
+++ b/.gitignore
@@ -3,10 +3,8 @@
 *.files
 *.includes
 *.creator.user
-bc
-!bc/
-dc
-!dc/
+bin/bc
+bin/dc
 *.o
 *.a
 .log_*.txt
@@ -14,7 +12,7 @@
 .math.txt
 .results.txt
 .ops.txt
-strgen
+gen/strgen
 lib.c
 bc_help.c
 dc_help.c
diff --git a/Makefile b/Makefile
index 73ffeb2..2ccb404 100644
--- a/Makefile
+++ b/Makefile
@@ -28,7 +28,9 @@
 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_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 @@
 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 @@
 	$(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
diff --git a/install.sh b/install.sh
index 751f40c..de99b75 100755
--- a/install.sh
+++ b/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 @@
 installdir="$1"
 shift
 
-exe="$1"
+bindir="$1"
 shift
 
-while [ ! -f "$exe" ]; do
-	exe="$1"
-	shift
-done
+cd "$bindir"
 
-"$INSTALL" -Dm 755 "$exe" "$installdir/$exe"
+for exe in ./*; do
 
-while [ $# -gt 0 ]; do
+	base=$(basename "$exe")
 
-	link="$1"
-	shift
-
-	base=$(basename "$link")
-
-	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
diff --git a/tests/all.sh b/tests/all.sh
index d27471b..6e36396 100755
--- a/tests/all.sh
+++ b/tests/all.sh
@@ -29,7 +29,7 @@
 fi
 
 if [ "$#" -lt 1 ]; then
-	exe="$testdir/../$d"
+	exe="$testdir/../bin/$d"
 else
 	exe="$1"
 fi
diff --git a/tests/bc/timeconst.sh b/tests/bc/timeconst.sh
index b5aad46..5756300 100755
--- a/tests/bc/timeconst.sh
+++ b/tests/bc/timeconst.sh
@@ -35,7 +35,7 @@
 	bc="$1"
 	shift
 else
-	bc="$testdir/../../bc"
+	bc="$testdir/../../bin/bc"
 fi
 
 out1="$testdir/../.log_bc.txt"
diff --git a/tests/errors.sh b/tests/errors.sh
index e9f0dc0..fd535e9 100755
--- a/tests/errors.sh
+++ b/tests/errors.sh
@@ -90,7 +90,7 @@
 fi
 
 if [ "$#" -lt 1 ]; then
-	exe="$testdir/../$d"
+	exe="$testdir/../bin/$d"
 else
 	exe="$1"
 	shift
diff --git a/tests/script.sh b/tests/script.sh
index d199bf7..a191c7a 100644
--- a/tests/script.sh
+++ b/tests/script.sh
@@ -27,7 +27,7 @@
 shift
 
 if [ "$#" -lt 1 ]; then
-	bc="$testdir/../bc"
+	bc="$testdir/../bin/bc"
 else
 	bc="$1"
 fi
diff --git a/tests/scripts.sh b/tests/scripts.sh
index b43e422..b09fce9 100755
--- a/tests/scripts.sh
+++ b/tests/scripts.sh
@@ -32,7 +32,7 @@
 	exe="$1"
 	shift
 else
-	exe="$testdir/../$d"
+	exe="$testdir/../bin/$d"
 fi
 
 out1="$testdir/../.log_bc.txt"
diff --git a/tests/test.sh b/tests/test.sh
index 5d0cf6b..ad33366 100755
--- a/tests/test.sh
+++ b/tests/test.sh
@@ -41,7 +41,7 @@
 	exe="$1"
 	shift
 else
-	exe="$testdir/../$d"
+	exe="$testdir/../bin/$d"
 fi
 
 out="$testdir/../.log_test.txt"