@@ -157,29 +157,54 @@ jobs:
157157 # 1. Clean first
158158 make clean
159159
160- echo "Compiling ALL source files manually to ensure complete library..."
161- # We need to compile everything EXCEPT the main program files (like analyze.f, minimize.f, etc.)
162- # However, identifying main programs is hard.
163- # STRATEGY: Compile everything to .o.
164- # libtinker.a should contain everything.
165- # The linker will only pull what it needs, or we might get unused symbol warnings, which is fine.
166- # If we include 'analyze.o' (with a main program) in libtinker.a, it *might* cause issues if linked twice,
167- # but usually the linker prefers the explicit object file over the library one.
168-
169- # BUT: To be safe, we can try to exclude known program files if possible, or just compile everything and let the linker sort it out.
170- # Let's compile everything with the correct flags.
160+ echo "Compiling Core Modules first to satisfy dependencies..."
161+ FLG="-c -O3 -fopenmp"
162+ # Compile lowest-level modules first (sizes, parameters, etc.)
163+ gfortran $FLG sizes.f || echo "Failed to compile sizes.f"
164+ gfortran $FLG inform.f || echo "Failed to compile inform.f"
165+ gfortran $FLG iounit.f || echo "Failed to compile iounit.f"
166+ gfortran $FLG keys.f || echo "Failed to compile keys.f"
167+ gfortran $FLG math.f || echo "Failed to compile math.f"
168+ gfortran $FLG units.f || echo "Failed to compile units.f"
169+ gfortran $FLG openmp.f || echo "Failed to compile openmp.f"
170+ gfortran $FLG params.f || echo "Failed to compile params.f"
171+ gfortran $FLG arg.f || echo "Failed to compile arg.f"
172+ gfortran $FLG atoms.f || echo "Failed to compile atoms.f"
173+ gfortran $FLG atomid.f || echo "Failed to compile atomid.f"
174+ gfortran $FLG angular.f || echo "Failed to compile angular.f"
175+ gfortran $FLG angles.f || echo "Failed to compile angles.f"
176+ gfortran $FLG angbnd.f || echo "Failed to compile angbnd.f"
177+ gfortran $FLG angpot.f || echo "Failed to compile angpot.f"
178+ gfortran $FLG bndpot.f || echo "Failed to compile bndpot.f"
179+ gfortran $FLG bnds.f || echo "Failed to compile bnds.f"
180+ gfortran $FLG bonds.f || echo "Failed to compile bonds.f"
181+ gfortran $FLG boxes.f || echo "Failed to compile boxes.f"
182+ gfortran $FLG bound.f || echo "Failed to compile bound.f"
183+ gfortran $FLG cell.f || echo "Failed to compile cell.f"
184+ gfortran $FLG couple.f || echo "Failed to compile couple.f"
185+ gfortran $FLG files.f || echo "Failed to compile files.f"
186+ gfortran $FLG limits.f || echo "Failed to compile limits.f"
187+ gfortran $FLG potent.f || echo "Failed to compile potent.f"
188+ gfortran $FLG ptable.f || echo "Failed to compile ptable.f"
189+ gfortran $FLG usage.f || echo "Failed to compile usage.f"
190+ gfortran $FLG virial.f || echo "Failed to compile virial.f"
191+
192+ echo "Compiling remaining source files..."
171193 for FILE in *.f; do
172- # Check if it's a program file (contains 'program main' or similar) - actually Tinker programs start with 'program <name>'
194+ # Skip if already compiled (check for .o existence)
195+ NAME=${FILE%.*}
196+ if [ -f "${NAME}.o" ]; then
197+ continue
198+ fi
199+
200+ # Check if it's a program file
173201 if grep -qi "^[[:space:]]*program" "$FILE"; then
174202 echo "Skipping program file: $FILE"
175203 continue
176204 fi
177205
178- # Compile with correct flags compatible with the rest of the build
179- # NO -fdefault-integer-8 (incompatible with defaults)
180- # YES -fopenmp (required for OpenMP symbols)
181- # YES -O3 (match optimization)
182- gfortran -c -O3 -fopenmp "$FILE" || echo "Failed to compile $FILE"
206+ # Compile rest
207+ gfortran $FLG "$FILE" || echo "Failed to compile $FILE"
183208 done
184209
185210 # Now rename the old broken target
0 commit comments