Jump to content

Makefile Example


Recommended Posts

M2 Download Center

Hidden Content

    Give reaction to this post to see the hidden content.
( 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.)
  • Love 4
Link to comment
  • 2 weeks later...

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


  • Read our Rules
  • Activity

    1. 2

      [Python] Code Translator 2 to 3

    2. 0

      bug gaya

    3. 5

      Fix Core Crash (unused serverside packet)

    4. 45

      Chest Drop View

    5. 0

      How to add Python 3.9 script?

    6. 15

      Metin2 Download Center - Specifications & Documentation

    7. 5

      Fix Core Crash (unused serverside packet)

    8. 45

      Chest Drop View

    9. 5

      Fix Core Crash (unused serverside packet)

  • Recently Browsing

    No registered users viewing this page.

×
×
  • 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.