Jump to content
metin2dev
Metin2International
Sign in to follow this  
Reboot

Creating your own makefile.

Recommended Posts

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.)
  • Like 4

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×