Is there a way to create a Makefile without running. / Configure?

I would like to skip the tests and create a default Makefile.

+1


source to share


3 answers


You can of course write the makefile by hand. A quick googling reveals a variety of tutorials. This option looks promising.

For the cliff notes version, the example boils down to this:



CC=g++
CFLAGS=-c -Wall
LDFLAGS=
SOURCES=main.cpp hello.cpp
OBJECTS=$(SOURCES:.cpp=.o)
EXECUTABLE=hello

all: $(SOURCES) $(EXECUTABLE)

$(EXECUTABLE): $(OBJECTS) 
    $(CC) $(LDFLAGS) $(OBJECTS) -o $@

.cpp.o:
    $(CC) $(CFLAGS) $< -o $@

      

+2


source


Why do you want to guess that the author worked hard? People don't generate configure scripts for fun - they generate configure scripts because figuring out the correct way to compile a program on your system is harsh and ./configure

easier than all the alternatives.



+1


source


If you are using Perl there is always a good ol

use ExtUtils::MakeMaker;

WriteMakefile(
    'NAME' => 'Foo::Bar',
    'DISTNAME' => 'Foo-Bar',
    'EXE_FILES' => ["foobar.sh"],
    'VERSION_FROM' => 'lib/Foo/Bar.pm',
    );

      

However, your question is a little short, if you are just building an existing project , you may find it impossible to skip setting.

0


source







All Articles