Makefile uses $(OS) to determine the OS and uses ifeq to either assign a.exe (Windows) or a.out (Linux) to a variable that stores the name of the executable. ifeq ($(OS), Windows_NT) EXECUTABLE=a.exe else EXECUTABLE=a.out endif $(EXECUTABLE): prog.c gcc prog.c
int main() {
return 42;
}