Makefile DB:
Makefile GAME:
.cpp Dosyalarının Otomatik Algılanması - Manuel Girişe Son!
Metin2 özel sunucu geliştirmesi sırasında C++ tabanlı sistemler üzerinde çalışırken, projeye dahil edilecek [.cpp] uzantılı dosyaların manuel olarak eklenmesi zaman alıcı ve hataya açık bir süreçtir. Özellikle büyük çaplı Metin2 PVP sistem projelerinde bu süreç, geliştiriciler için ciddi bir mühendislik problemi haline gelebilir. Bu nedenle, [.cpp] dosyalarının otomatik olarak algılanması ve derleme sürecine dahil edilmesi, hem verimliliği artırır hem de hata riskini azaltır.
Otomatik Tanıma Sistemi Nedir?
Otomatik [.cpp] dosyası tanıma, bir derleme sisteminin belirli bir dizinde bulunan tüm [.cpp] uzantılı dosyaları tarayıp, otomatik olarak derleme listesine eklemesidir. Bu sistem, özellikle Metin2 server src geliştirme ortamlarında yaygın olarak kullanılır. Klasör yapısında [.cpp] uzantılı her dosya, derleme sırasında otomatik olarak sisteme dahil edilir. Böylece geliştirici, yeni bir [.cpp] dosyası oluşturduğunda manuel olarak Makefile ya da proje dosyasına eklemek zorunda kalmaz.
Neden Manuel Girdiye Gerek Yok?
Manuel olarak [.cpp] dosyası eklemek, özellikle sürekli yeni sistemler eklenen Metin2 development projelerinde büyük bir zaman kaybına neden olur. Her yeni dosya için proje ayarlarını değiştirmek, derleme hatalarına sebep olabilir. Otomatik sistem sayesinde, geliştiriciler sadece kodlama odaklı kalabilir. Bu da source edit ve game core geliştirmelerinde verimi ciddi anlamda artırır.
Python ile Otomatik Derleme Scriptleri
Python dili, [.cpp] dosyalarının taranması ve derleme listesine eklenmesi için ideal bir araçtır. Py root ve py gui sistemleriyle entegre çalışan scriptler sayesinde, dosya sistemi taranabilir ve derleme süreci otomatikleştirilebilir. Örneğin, bir Python scripti, belirtilen dizindeki tüm [.cpp] uzantılı dosyaları toplayabilir ve Makefile veya CMakeLists.txt dosyasına yazabilir.
Derleme Sürecindeki Faydaları
Otomatik [.cpp] tanımı, compile süresini kısaltmaz ama derleme sürecinin daha kontrollü ve hatasız olmasını sağlar. Özellikle Martysama gibi sistemlerde, otomatik dosya tarama altyapısı sayesinde eksik dosya girişlerinden kaynaklı hatalar minimize edilir. Ayrıca, [.cpp] dosyalarının gruplandırılması ve modüler yapıda tutulması, Metin2 PVP systems üzerinde daha temiz bir geliştirme deneyimi sunar.
Pratik Uygulama: Basit Python Script Örneği
Aşağıdaki basit Python scripti, belirli bir klasördeki tüm [.cpp] dosyalarını tarar ve bir derleme listesi oluşturur:
Bu şekilde, [.cpp] dosyaları kolayca tespit edilip derleme sistemine entegre edilebilir.
Sonuç
Otomatik [.cpp] dosyası tarama ve derleme sistemi, Metin2Dev süreçlerini önemli ölçüde kolaylaştırır. Özellikle client src ve game server programming süreçlerinde, bu tarz otomasyonlar zaman kazandırır ve hata riskini azaltır. Manuel girdiye son vermek, profesyonel ve sürdürülebilir bir geliştirme ortamı kurmak açısından kritik öneme sahiptir.
Automatic Detection of .cpp Files - An End to Manual Entry!
While developing Metin2 private server projects involving C++-based systems, manually adding [.cpp] files to the project can be a time-consuming and error-prone process. Especially in large-scale Metin2 PVP system projects, this process can become a significant engineering challenge for developers. Therefore, automatically detecting [.cpp] files and including them in the build process enhances efficiency and reduces the risk of errors.
What Is an Automatic Recognition System?
Automatic [.cpp] file recognition refers to a build system scanning for all [.cpp] files in a specific directory and automatically adding them to the build list. This system is widely used in Metin2 server src development environments. Every [.cpp] file found within the folder structure is included in the build process automatically. As a result, when a developer creates a new [.cpp] file, there's no need to manually add it to the Makefile or project file.
Why No Need for Manual Input?
Manually adding [.cpp] files can cause significant time loss in Metin2 development projects where new systems are constantly being added. Changing project settings for every new file may lead to build errors. Thanks to the automatic system, developers can focus solely on coding. This significantly increases efficiency in source edit and game core development.
Python-Based Build Scripts
Python is an ideal tool for scanning [.cpp] files and adding them to the build list. Scripts integrated with Py root and py gui systems can scan the file system and automate the build process. For example, a Python script can gather all [.cpp] files from a given directory and write them into a Makefile or CMakeLists.txt file.
Benefits During the Build Process
Automatic [.cpp] detection does not reduce compile time but ensures a more controlled and error-free build process. Particularly in systems like Martysama, the automatic file scanning infrastructure minimizes errors caused by missing file entries. Moreover, organizing [.cpp] files into modules provides a cleaner development experience for Metin2 PVP systems.
Practical Application: Simple Python Script Example
The following simple Python script scans for all [.cpp] files in a specified folder and generates a build list:
In this way, [.cpp] files can easily be detected and integrated into the build system.
Conclusion
An automatic [.cpp] file scanning and build system significantly simplifies Metin2Dev processes. Especially during client src and game server programming phases, such automation saves time and reduces error risks. Ending manual input is crucial for creating a professional and sustainable development environment.
Kod:
# Makefile edit by: Grzyb.ovh # Nie trzeba już ręcznie wprowadzać nazw plików .cpp, ponieważ teraz wszystko jest wykrywane automatycznie! # You no longer need to manually enter the names of .cpp files, as everything is now detected automatically! # Es ist nicht mehr notwendig, die Namen von .cpp-Dateien manuell einzugeben, da jetzt alles automatisch erkannt wird! # Artık .cpp dosya isimlerini manuel olarak girmenize gerek yok, çünkü her şey artık otomatik olarak algılanıyor! CC = gcc10 CXX = g++10 DB_VERSION = $(shell cat ../../__REVISION__) INCDIR = LIBDIR = BINDIR = .. OBJDIR = .obj $(shell if [ ! -d $(OBJDIR) ]; then mkdir $(OBJDIR); fi) ENABLE_GCC_AUTODEPEND = 1 ENABLE_STATIC = 0 ifneq ($(ENABLE_GCC_AUTODEPEND), 1) DEPFILE = Depend endif CFLAGS = -m32 -g -Wall -O2 -pipe -fno-rtti -fno-exceptions -Wno-long-long -pthread -D_THREAD_SAFE CFLAGS += -Wno-deprecated-declarations -Wno-nonnull-compare -Wno-deprecated-declarations -Wno-array-bounds -Wno-address CFLAGS += -Wno-int-in-bool-context -Wno-format-truncation -Wno-class-memaccess CXXFLAGS = -std=c++20 -Wl,-rpath=/usr/local/lib/gcc10 ifeq ($(ENABLE_STATIC), 1) CFLAGS += -static endif CFLAGS += -D__USER__=\"$(USER)\" -D__HOSTNAME__=\"$(HOSTNAME)\" -D__PWD__=\"$(PWD)\" -D__DB_VERSION__=\"$(DB_VERSION)\" INCDIR += -I../../../Extern/include/boost INCDIR += -I/usr/local/include/mysql LIBS += /usr/local/lib/mysql/libmysqlclient.a /usr/lib/libz.a INCDIR += -I/usr/local/include INCDIR += -I../../../Extern/include LIBDIR += -I../../../Extern/lib LIBDIR += -L../../libthecore/lib -L../../libsql -L../../libpoly -L../../libgame/lib LIBS += -lthecore -lsql -lpoly -lgame -lm LIBS += -lssl -lcrypto CPPFILE = $(wildcard *.cpp) CPPOBJS = $(CPPFILE:%.cpp=$(OBJDIR)/%.o) ifeq ($(ENABLE_GCC_AUTODEPEND), 1) CPPDEPS = $(CPPOBJS:%.o=%.d) endif MAIN_TARGET = $(BINDIR)/db_r$(DB_VERSION) default: $(MAIN_TARGET) $(MAIN_TARGET): $(CPPOBJS) @echo linking $(MAIN_TARGET) @$(CXX) $(CFLAGS) $(CXXFLAGS) $(LIBDIR) $(CPPOBJS) $(LIBS) -o $(MAIN_TARGET) $(OBJDIR)/%.o: %.cpp @echo compiling $< @$(CXX) $(CFLAGS) $(CXXFLAGS) $(INCDIR) -c $< -o $@ ifeq ($(ENABLE_GCC_AUTODEPEND), 1) @$(CXX) -MM -MG -MP $(CFLAGS) $(CXXFLAGS) $(INCDIR) -c $< -o $(OBJDIR)/$*.d @sed -i '' -e's/$*.o:/$(OBJDIR)\/$*.o:/g' $(OBJDIR)/$*.d endif $(OBJDIR): @mkdir $(OBJDIR) symlink: @ln -fs db_r$(DB_VERSION) $(BINDIR)/db_symlink strip: @cp $(BINDIR)/db_r$(DB_VERSION) $(BINDIR)/db_r @strip $(BINDIR)/db_r clean: @rm -f $(CPPOBJS) $(BINDIR)/db_r* dep: ifeq ($(ENABLE_GCC_AUTODEPEND), 1) @echo "Note: gcc autodepend is autodetected, so target dep skipped" else makedepend -f $(DEPFILE) $(INCDIR) -I/usr/include/c++/3.3 -I/usr/include/c++/4.2 -p$(OBJDIR)/ $(CPPFILE) 2> /dev/null > $(DEPFILE) endif ifeq ($(ENABLE_GCC_AUTODEPEND), 1) sinclude $(CPPDEPS) else sinclude $(DEPFILE) endif
Makefile GAME:
Kod:
# Makefile edit by: Grzyb.ovh # Nie trzeba już ręcznie wprowadzać nazw plików .cpp, ponieważ teraz wszystko jest wykrywane automatycznie! # You no longer need to manually enter the names of .cpp files, as everything is now detected automatically! # Es ist nicht mehr notwendig, die Namen von .cpp-Dateien manuell einzugeben, da jetzt alles automatisch erkannt wird! # Artık .cpp dosya isimlerini manuel olarak girmenize gerek yok, çünkü her şey artık otomatik olarak algılanıyor! CXX = g++10 GAME_VERSION := $(shell cat ../../__REVISION__) GccMajorVersion := $(shell expr `$(CXX) -dumpversion | cut -f1 -d.`) GccMinorVersion := $(shell expr `$(CXX) -dumpversion | cut -f2 -d.`) GccMinorEGT8 := $(shell expr $(GccMinorVersion) \>= 8) INCDIR = LIBDIR = BINDIR = .. OBJDIR = .obj $(shell if [ ! -d $(OBJDIR) ]; then mkdir $(OBJDIR); fi) ENABLE_GOOGLE_TEST = 0 ENABLE_LUA_5_VERSION = 0 ENABLE_GCC_AUTODEPEND = 1 ENABLE_STATIC = 0 ifneq ($(ENABLE_GCC_AUTODEPEND), 1) DEPFILE = Depend endif LIBS = -lm -lmd CFLAGS = -m32 -g -Wall -O2 -pipe -fexceptions -fno-strict-aliasing -pthread -D_THREAD_SAFE -DNDEBUG CFLAGS += -Wno-deprecated-declarations -Wno-nonnull-compare -Wno-deprecated-declarations -Wno-array-bounds -Wno-address CFLAGS += -Wno-int-in-bool-context -Wno-format-truncation -Wno-stringop-truncation -Wno-sign-compare -Wno-class-memaccess CXXFLAGS = -std=c++20 -Wl,-rpath=/usr/local/lib/gcc10 ifeq ($(ENABLE_STATIC), 1) CFLAGS += -static endif ifeq ($(GccMinorEGT8), 1) CFLAGS += -Wno-unused-local-typedefs endif CFLAGS += -fstack-protector-all CFLAGS += -D__USER__=\"$(USER)\" -D__HOSTNAME__=\"$(HOSTNAME)\" -D__PWD__=\"$(PWD)\" -D__GAME_VERSION__=\"$(GAME_VERSION)\" INCDIR += -I../../../Extern/include/boost INCDIR += -I../../../Extern/include/IL LIBS += ../../../Extern/lib/libIL.a\ ../../../Extern/lib/libjasper.a\ ../../../Extern/lib/libpng.a\ ../../../Extern/lib/libtiff.a\ ../../../Extern/lib/libjbig.a\ ../../../Extern/lib/libmng.a\ /usr/lib/liblzma.a\ ../../../Extern/lib/liblcms.a\ ../../../Extern/lib/libjpeg.a INCDIR += -I/usr/local/include/mysql LIBS += /usr/local/lib/mysql/libmysqlclient.a /usr/lib/libz.a LIBS += ../../../Extern/lib/libcryptopp.a INCDIR += -I/usr/include LIBS += -lssl -lcrypto CFLAGS += -DENABLE_LUA_5_VERSION=ENABLE_LUA_5_VERSION ifeq ($(ENABLE_LUA_5_VERSION), 2) INCDIR += -I../../liblua/5.2/install/include LIBDIR += -L../../liblua/5.2/install/lib LIBS += ../../liblua/5.2/install/lib/liblua.a else INCDIR += -I../../liblua/5.0/include LIBDIR += -L../../liblua/5.0/lib LIBS += ../../liblua/5.0/lib/liblua.a ../../liblua/5.0/lib/liblualib.a endif INCDIR += -I../../../Extern/include INCDIR += -I/usr/local/include LIBDIR += -L/usr/local/lib LIBDIR += -L../../libthecore/lib -L../../libpoly -L../../libsql -L../../libgame/lib LIBS += -lthecore -lpoly -lsql -lgame MAINCPP = main.cpp CFILE = minilzo.cpp CPPFILE = $(filter-out main.cpp minilzo.cpp, $(wildcard *.cpp)) COBJS = $(CFILE:%.cpp=$(OBJDIR)/%.o) CPPOBJS = $(CPPFILE:%.cpp=$(OBJDIR)/%.o) ifeq ($(ENABLE_GCC_AUTODEPEND), 1) CDEPS = $(COBJS:%.o=%.d) CPPDEPS = $(CPPOBJS:%.o=%.d) endif MAINOBJ = $(MAINCPP:%.cpp=$(OBJDIR)/%.o) ifeq ($(ENABLE_GCC_AUTODEPEND), 1) MAINDEPS = $(MAINOBJ:%.o=%.d) endif MAIN_TARGET = $(BINDIR)/game_r$(GAME_VERSION) default: $(MAIN_TARGET) test: $(TEST_TARGET) $(OBJDIR)/%.o: %.c @echo compiling $< @$(CXX) $(CFLAGS) $(INCDIR) -c $< -o $@ ifeq ($(ENABLE_GCC_AUTODEPEND), 1) @$(CXX) -MM -MG -MP $(CFLAGS) $(INCDIR) -c $< -o $(OBJDIR)/$*.d @sed -i '' -e's/$*.o:/$(OBJDIR)\/$*.o:/g' $(OBJDIR)/$*.d endif $(OBJDIR)/%.o: %.cpp @echo compiling $< @$(CXX) $(CFLAGS) $(CXXFLAGS) $(INCDIR) -c $< -o $@ ifeq ($(ENABLE_GCC_AUTODEPEND), 1) @$(CXX) -MM -MG -MP $(CFLAGS) $(CXXFLAGS) $(INCDIR) -c $< -o $(OBJDIR)/$*.d @sed -i '' -e's/$*.o:/$(OBJDIR)\/$*.o:/g' $(OBJDIR)/$*.d endif limit_time: @echo update limit time @python update_limit_time.py $(MAIN_TARGET): $(CPPOBJS) $(COBJS) $(MAINOBJ) @echo linking $(MAIN_TARGET) @$(CXX) $(CFLAGS) $(CXXFLAGS) $(LIBDIR) $(COBJS) $(CPPOBJS) $(MAINOBJ) $(LIBS) -o $(MAIN_TARGET) symlink: @ln -fs game_r$(GAME_VERSION) $(BINDIR)/game_symlink strip: @cp $(MAIN_TARGET) $(BINDIR)/game_r @strip $(BINDIR)/game_r clean: @echo cleaning $(MAIN_TARGET) $(OBJDIR) @rm -f $(COBJS) $(CPPOBJS) $(MAINOBJ) ifeq ($(ENABLE_GCC_AUTODEPEND), 1) @rm -f $(CDEPS) $(CPPDEPS) $(MAINDEPS) endif @rm -f $(BINDIR)/game_r* $(BINDIR)/test_r* $(BINDIR)/conv dep: ifeq ($(ENABLE_GCC_AUTODEPEND), 1) @echo "Note: gcc autodepend is autodetected, so target dep skipped" else makedepend -f $(DEPFILE) $(INCDIR) -I/usr/include/c++/3.3 -I/usr/include/c++/4.2 -p$(OBJDIR)/ $(CPPFILE) $(CFILE) $(MAINCPP) $(TESTCPP) 2> /dev/null > $(DEPFILE) endif ifeq ($(ENABLE_GCC_AUTODEPEND), 1) sinclude $(CDEPS) sinclude $(CPPDEPS) sinclude $(MAINDEPS) else sinclude $(DEPFILE) endif
.cpp Dosyalarının Otomatik Algılanması - Manuel Girişe Son!
Metin2 özel sunucu geliştirmesi sırasında C++ tabanlı sistemler üzerinde çalışırken, projeye dahil edilecek [.cpp] uzantılı dosyaların manuel olarak eklenmesi zaman alıcı ve hataya açık bir süreçtir. Özellikle büyük çaplı Metin2 PVP sistem projelerinde bu süreç, geliştiriciler için ciddi bir mühendislik problemi haline gelebilir. Bu nedenle, [.cpp] dosyalarının otomatik olarak algılanması ve derleme sürecine dahil edilmesi, hem verimliliği artırır hem de hata riskini azaltır.
Otomatik Tanıma Sistemi Nedir?
Otomatik [.cpp] dosyası tanıma, bir derleme sisteminin belirli bir dizinde bulunan tüm [.cpp] uzantılı dosyaları tarayıp, otomatik olarak derleme listesine eklemesidir. Bu sistem, özellikle Metin2 server src geliştirme ortamlarında yaygın olarak kullanılır. Klasör yapısında [.cpp] uzantılı her dosya, derleme sırasında otomatik olarak sisteme dahil edilir. Böylece geliştirici, yeni bir [.cpp] dosyası oluşturduğunda manuel olarak Makefile ya da proje dosyasına eklemek zorunda kalmaz.
Neden Manuel Girdiye Gerek Yok?
Manuel olarak [.cpp] dosyası eklemek, özellikle sürekli yeni sistemler eklenen Metin2 development projelerinde büyük bir zaman kaybına neden olur. Her yeni dosya için proje ayarlarını değiştirmek, derleme hatalarına sebep olabilir. Otomatik sistem sayesinde, geliştiriciler sadece kodlama odaklı kalabilir. Bu da source edit ve game core geliştirmelerinde verimi ciddi anlamda artırır.
Python ile Otomatik Derleme Scriptleri
Python dili, [.cpp] dosyalarının taranması ve derleme listesine eklenmesi için ideal bir araçtır. Py root ve py gui sistemleriyle entegre çalışan scriptler sayesinde, dosya sistemi taranabilir ve derleme süreci otomatikleştirilebilir. Örneğin, bir Python scripti, belirtilen dizindeki tüm [.cpp] uzantılı dosyaları toplayabilir ve Makefile veya CMakeLists.txt dosyasına yazabilir.
Derleme Sürecindeki Faydaları
Otomatik [.cpp] tanımı, compile süresini kısaltmaz ama derleme sürecinin daha kontrollü ve hatasız olmasını sağlar. Özellikle Martysama gibi sistemlerde, otomatik dosya tarama altyapısı sayesinde eksik dosya girişlerinden kaynaklı hatalar minimize edilir. Ayrıca, [.cpp] dosyalarının gruplandırılması ve modüler yapıda tutulması, Metin2 PVP systems üzerinde daha temiz bir geliştirme deneyimi sunar.
Pratik Uygulama: Basit Python Script Örneği
Aşağıdaki basit Python scripti, belirli bir klasördeki tüm [.cpp] dosyalarını tarar ve bir derleme listesi oluşturur:
Kod:
import os[BR][/BR]def find_cpp_files(directory):[BR][/BR] cpp_files = [*][BR][/BR] for root, dirs, files in os.walk(directory):[BR][/BR] for file in files:[BR][/BR] if file.endswith('.cpp'):[BR][/BR] cpp_files.append(os.path.join(root, file))[BR][/BR] return cpp_files[BR][/BR][BR][/BR]files = find_cpp_files('./src')[BR][/BR]for f in files:[BR][/BR] print(f)
Bu şekilde, [.cpp] dosyaları kolayca tespit edilip derleme sistemine entegre edilebilir.
Sonuç
Otomatik [.cpp] dosyası tarama ve derleme sistemi, Metin2Dev süreçlerini önemli ölçüde kolaylaştırır. Özellikle client src ve game server programming süreçlerinde, bu tarz otomasyonlar zaman kazandırır ve hata riskini azaltır. Manuel girdiye son vermek, profesyonel ve sürdürülebilir bir geliştirme ortamı kurmak açısından kritik öneme sahiptir.
Automatic Detection of .cpp Files - An End to Manual Entry!
While developing Metin2 private server projects involving C++-based systems, manually adding [.cpp] files to the project can be a time-consuming and error-prone process. Especially in large-scale Metin2 PVP system projects, this process can become a significant engineering challenge for developers. Therefore, automatically detecting [.cpp] files and including them in the build process enhances efficiency and reduces the risk of errors.
What Is an Automatic Recognition System?
Automatic [.cpp] file recognition refers to a build system scanning for all [.cpp] files in a specific directory and automatically adding them to the build list. This system is widely used in Metin2 server src development environments. Every [.cpp] file found within the folder structure is included in the build process automatically. As a result, when a developer creates a new [.cpp] file, there's no need to manually add it to the Makefile or project file.
Why No Need for Manual Input?
Manually adding [.cpp] files can cause significant time loss in Metin2 development projects where new systems are constantly being added. Changing project settings for every new file may lead to build errors. Thanks to the automatic system, developers can focus solely on coding. This significantly increases efficiency in source edit and game core development.
Python-Based Build Scripts
Python is an ideal tool for scanning [.cpp] files and adding them to the build list. Scripts integrated with Py root and py gui systems can scan the file system and automate the build process. For example, a Python script can gather all [.cpp] files from a given directory and write them into a Makefile or CMakeLists.txt file.
Benefits During the Build Process
Automatic [.cpp] detection does not reduce compile time but ensures a more controlled and error-free build process. Particularly in systems like Martysama, the automatic file scanning infrastructure minimizes errors caused by missing file entries. Moreover, organizing [.cpp] files into modules provides a cleaner development experience for Metin2 PVP systems.
Practical Application: Simple Python Script Example
The following simple Python script scans for all [.cpp] files in a specified folder and generates a build list:
Kod:
import os[BR][/BR]def find_cpp_files(directory):[BR][/BR] cpp_files = [*][BR][/BR] for root, dirs, files in os.walk(directory):[BR][/BR] for file in files:[BR][/BR] if file.endswith('.cpp'):[BR][/BR] cpp_files.append(os.path.join(root, file))[BR][/BR] return cpp_files[BR][/BR][BR][/BR]files = find_cpp_files('./src')[BR][/BR]for f in files:[BR][/BR] print(f)
In this way, [.cpp] files can easily be detected and integrated into the build system.
Conclusion
An automatic [.cpp] file scanning and build system significantly simplifies Metin2Dev processes. Especially during client src and game server programming phases, such automation saves time and reduces error risks. Ending manual input is crucial for creating a professional and sustainable development environment.
