Jump to content

Makefile Example


Reboot

Recommended Posts

M2 Download Center

This is the hidden content, please
( Internal )

Hi friends, today I'll show you how to create your own makefile ,

 

 

Makefile libgame.a

BIN = ../libgame.a

CXX = g++
CFLAGS = -Wall -O2 -pipe -mtune=i686

OBJFILES = grid.o attribute.o targa.o

######################################################################

default:
	@echo 'Compiling grid.cc';        $(CXX) $(CFLAGS) -c grid.cc
	@echo 'Compiling attribute.cc';   $(CXX) $(CFLAGS) -c attribute.cc
	@echo 'Compiling targa.cc';       $(CXX) $(CFLAGS) -c targa.cc
	@echo 'Create library';           ar cru $(BIN) $(OBJFILES)
	@echo 'Compiling static';         ranlib $(BIN)
	@echo 'Delete .obj files';        rm -f *.o

Makefile libpoly.a

BIN = ../libpoly.a

CXX = g++
CFLAGS = -Wall -O2 -pipe -mtune=i686 -fno-exceptions -fno-rtti


########################################################################################################
OBJFILES = Base.o Poly.o Symbol.o SymTable.o

default:
	@echo 'Compiling Base'     ;   $(CXX) $(CFLAGS) -c Base.cc
	@echo 'Compiling Poly'     ;   $(CXX) $(CFLAGS) -c Poly.cc
	@echo 'Compiling Symbol'   ;   $(CXX) $(CFLAGS) -c Symbol.cc
	@echo 'Compiling SymTable' ;   $(CXX) $(CFLAGS) -c SymTable.cc

	@echo 'Create library static';    ar cru $(BIN) $(OBJFILES)
	@echo 'Compiling';                ranlib $(BIN)
	@echo 'Delete .obj files';        rm -f *.o

Makefile libsql.a

BIN = ../libsql.a

CXX = g++
CFLAGS = -Wall -O2 -pipe -mtune=i686 -D_THREAD_SAFE -fno-exceptions


########################################################################################################
OBJFILES = AsyncSQL.o Semaphore.o Tellwait.o Statement.o
INCDIR = -I/src_reboot_def/extern/mysql_5.6.22

default:
	@echo 'Compiling AsyncSQL';        $(CXX) $(INCDIR) $(CFLAGS) -c AsyncSQL.cpp
	@echo 'Compiling Semaphore';       $(CXX) $(INCDIR) $(CFLAGS) -c Semaphore.cpp
	@echo 'Compiling Tellwait';        $(CXX) $(INCDIR) $(CFLAGS) -c Tellwait.cpp
	@echo 'Compiling Statement';       $(CXX) $(INCDIR) $(CFLAGS) -c Statement.cpp

	@echo 'Create library static';    ar cru $(BIN) $(OBJFILES)
	@echo 'Compiling';                ranlib $(BIN)
	@echo 'Delete .obj files';        rm -f *.o

Makefile libthecore.a

BIN = ../libthecore.a

CXX = g++
CFLAGS = -Wall -O2 -pipe -mtune=i686 -g


########################################################################################################
OBJFILES = socket.o fdwatch.o buffer.o signal.o log.o utils.o kstbl.o hangul.o heart.o main.o tea.o des.o gost.o memcpy.o
default:
	@echo 'Compiling socket' ;       $(CXX) $(CFLAGS) -c socket.c
	@echo 'Compiling fdwatch';       $(CXX) $(CFLAGS) -c fdwatch.c
	@echo 'Compiling buffer' ;       $(CXX) $(CFLAGS) -c buffer.c
	@echo 'Compiling signal' ;       $(CXX) $(CFLAGS) -c signal.c
	@echo 'Compiling log'    ;       $(CXX) $(CFLAGS) -c log.c
	@echo 'Compiling utils'  ;       $(CXX) $(CFLAGS) -c utils.c
	@echo 'Compiling kstbl'  ;       $(CXX) $(CFLAGS) -c kstbl.c
	@echo 'Compiling hangul' ;       $(CXX) $(CFLAGS) -c hangul.c
	@echo 'Compiling heart'  ;       $(CXX) $(CFLAGS) -c heart.c
	@echo 'Compiling main'   ;       $(CXX) $(CFLAGS) -c main.c
	@echo 'Compiling tea'    ;       $(CXX) $(CFLAGS) -c tea.c
	@echo 'Compiling des'    ;       $(CXX) $(CFLAGS) -c des.c
	@echo 'Compiling gost'   ;       $(CXX) $(CFLAGS) -c gost.c
	@echo 'Compiling memcpy' ;       $(CXX) $(CFLAGS) -c memcpy.c

	@echo 'Create library static';    ar cru $(BIN) $(OBJFILES)
	@echo 'Compiling';                ranlib $(BIN)
	@echo 'Delete .obj files';        rm -f *.o

I can not understand why do some makefile so YMIR compilcate.

 

I forgot to tell you, .o files have removed.

File depend removed.

@echo 'Compiling grid.cc'

Instead of compiling grid ask what message you want

 

If you have errors, leave reply.

 

 

If you want to make simple makefile, organized, easy to modify.
 
And for the rest of the library. (Libsql, libthecore etc.)
  • Metin2 Dev 2
  • Think 1
  • Love 10
Link to comment
Share on other sites

  • 2 weeks later...

Announcements



×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.