Tue, 04 Nov 2025 22:26:27 +0100
update uwproj (fixes configure on solaris)
| 0 | 1 | #!/bin/sh |
| 2 | ||
| 3 | dir="$1" | |
| 4 | target="$2" | |
| 5 | extra_flags="$3" | |
| 6 | ||
| 7 | if [ -z "$dir" ]; then | |
| 8 | echo "Usage: $0 <src_dir>" | |
| 9 | exit 1 | |
| 10 | fi | |
| 11 | ||
| 12 | if [ -z "$target" ]; then | |
| 13 | target='../build' | |
| 14 | fi | |
| 15 | ||
| 16 | if [ -d "$dir" ]; then | |
| 17 | : | |
| 18 | else | |
| 19 | echo "'$dir' is not a directory" | |
| 20 | exit 1 | |
| 21 | fi | |
| 22 | ||
| 23 | if [ -z "$CXX" ]; then | |
| 24 | for cxx in g++ clang++ ; do | |
| 25 | if command -v "$cxx" > /dev/null ; then | |
| 26 | CXX="$cxx" | |
| 27 | break | |
| 28 | fi | |
| 29 | done | |
| 30 | fi | |
| 31 | ||
| 32 | if [ -z "$CXX" ]; then | |
| 33 | echo "No suitable compiler found to generate make rules" | |
| 34 | exit 1 | |
| 35 | fi | |
| 36 | ||
| 37 | if command -v sed > /dev/null ; then | |
| 38 | : | |
| 39 | else | |
| 40 | echo "You need the 'sed' program for this script to work." | |
| 41 | exit 1 | |
| 42 | fi | |
| 43 | ||
| 44 | cd "$dir" | |
| 45 | ||
| 46 | mv Makefile Makefile.old | |
| 47 | sed '/FORCE:/q' Makefile.old > Makefile | |
| 48 | echo >> Makefile | |
| 49 | for file in `ls *.cpp` ; do | |
| 50 | "$CXX" -MT "$target/${file/.cpp/\.o}" -MM $CXXFLAGS $extra_flags "$file" | |
| 51 | printf '\t@echo "Compiling $<"\n' | |
| 52 | printf '\t$(CXX) -o $@ $(CXXFLAGS) %s -c $<\n\n' "$extra_flags" | |
| 53 | done >> Makefile | |
| 54 | rm Makefile.old | |
| 55 |