Main
EXAMPLE makefile


For this example make tool searching *.cpp files and expose them to compilation. Then, all *.o (for this example: obj1.o, obj2.o, obj3.o) are linked for producing main.exe. String '<TAB>' must be exchanged for tab (keyboard key). Program's binary files (.o, .exe) must be deleted before next compilation. Words after '#' are comments.
> make all #this command will run 'make' tool for all compilation


CPP = g++ # compilator name
INCS = #-I"non_default_include_headers_dir"
LIBS = -lglfw -lopengl32 -lglu32 #-L"non_default_libs_dir" -l(linking static libraries)
WINMODE = -mwindows # / or -mconsole / (for showing graphic and console window)
CFLAGS = -c -O3 # compilation with example optimalization
LFLAGS = -s # linking with size optimalization
OBJECTS = main.o obj1.o obj2.o obj3.o

.SUFFIXES: .o.cpp
.cpp.o:
<TAB> $(CPP) $(CFLAGS) $< -o $@ $(INCS)

main.exe:
<TAB> $(CPP) $(LFLAGS) $(WINMODE) $(OBJECTS) -o $@ $(LIBS)

all: $(OBJECTS) main.exe
Hosted by www.Geocities.ws

1