URL: <https://savannah.gnu.org/bugs/?56484>
Summary: [RFE] compile modified files first Project: make Submitted by: None Submitted on: Wed 12 Jun 2019 09:07:39 PM UTC Severity: 3 - Normal Item Group: Enhancement Status: None Privacy: Public Assigned to: None Open/Closed: Open Discussion Lock: Any Component Version: 4.2.1 Operating System: POSIX-Based Fixed Release: None Triage Status: None _______________________________________________________ Details: Problem: if a project has 300 C files and a single header that's included everywhere, and then someone changes 2 files: the header and any C file, most likely one wants to know whether the changes caused build errors. However, after executing `make`, in the worst case, the changed C file may get built after the 299 others, and fail the build. Ultimately, when rebuilding a project, one is interested (well, besides of course having the binaries) in "did my changes cause any problem?" question. Solution: before building, sort files to build by "was it changed after last build" field, and compile changed ones first. Such behavior sounds benefical to most existing projects, and could be controlled by an env. variable, like MAKE_NO_SORT, to opt out. # Steps to reproduce (in terms of terminal commands): $ cat Makefile OBJECTS = main.o empty1.o empty2.o HEADERS = header.h default: myapp %.o : %.c $(HEADERS) gcc -c $< -o $@ myapp: $(OBJECTS) gcc $(OBJECTS) -o $@ $ touch empty1.c empty2.c header.h && echo "int main() {}" > main.c $ make gcc -c main.c -o main.o gcc -c empty1.c -o empty1.o gcc -c empty2.c -o empty2.o gcc main.o empty1.o empty2.o -o myapp $ touch header.h empty2.c $ make ## Expected output: gcc -c empty2.c -o empty2.o gcc -c main.c -o main.o gcc -c empty1.c -o empty1.o gcc main.o empty1.o empty2.o -o myapp ## Actual output: gcc -c main.c -o main.o gcc -c empty1.c -o empty1.o gcc -c empty2.c -o empty2.o gcc main.o empty1.o empty2.o -o myapp _______________________________________________________ Reply to this item at: <https://savannah.gnu.org/bugs/?56484> _______________________________________________ Message sent via Savannah https://savannah.gnu.org/ _______________________________________________ Bug-make mailing list Bug-make@gnu.org https://lists.gnu.org/mailman/listinfo/bug-make