bug-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug #56484] [RFE] compile modified files first


From: anonymous
Subject: [bug #56484] [RFE] compile modified files first
Date: Wed, 12 Jun 2019 17:07:41 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) QtWebEngine/5.12.3 Chrome/69.0.3497.128 Safari/537.36

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/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]