diff options
| author | fusion32 <marcopuzziello@gmail.com> | 2025-05-25 22:37:57 -0300 |
|---|---|---|
| committer | fusion32 <marcopuzziello@gmail.com> | 2025-05-25 22:37:57 -0300 |
| commit | ad8213f35523cbb07f418ae275af448a47cc0288 (patch) | |
| tree | 4d77b8ff2b44461734b5a2cbaad5402b4a94736f /Makefile | |
| parent | 5f883a80175a4cc9abda9d647a6a0d73bda84878 (diff) | |
| download | game-ad8213f35523cbb07f418ae275af448a47cc0288.tar.gz game-ad8213f35523cbb07f418ae275af448a47cc0288.zip | |
linux Makefile + fix most compilation problems
I wanted to see if the compiler had any problems with the code
so far and added a few stub definitions so that each file would
properly compile. We still fail when linking but we're able to to
find and fix compile time errors.
Diffstat (limited to 'Makefile')
| -rw-r--r-- | Makefile | 75 |
1 files changed, 75 insertions, 0 deletions
diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..18037c1 --- /dev/null +++ b/Makefile @@ -0,0 +1,75 @@ +SRCDIR = src +BUILDDIR = build +OUTPUTEXE = game + +CC = g++ +CFLAGS = -m64 -fno-strict-aliasing -Wall -Wextra -Wno-unused-parameter -Wno-format-truncation -std=c++11 -DOS_LINUX=1 -DARCH_X64=1 -D_CRT_SECURE_NO_WARNINGS=1 +LFLAGS = -Wl,-t + +DEBUG ?= 0 +ifneq ($(DEBUG), 0) + CFLAGS += -g -O0 +else + CFLAGS += -O2 +endif + +HEADERS = $(SRCDIR)/common.hh $(SRCDIR)/config.hh $(SRCDIR)/connection.hh $(SRCDIR)/containers.hh $(SRCDIR)/creature.hh $(SRCDIR)/enums.hh $(SRCDIR)/map.hh $(SRCDIR)/monster.hh $(SRCDIR)/objects.hh $(SRCDIR)/player.hh $(SRCDIR)/script.hh $(SRCDIR)/skill.hh $(SRCDIR)/thread.hh + +$(BUILDDIR)/$(OUTPUTEXE): $(BUILDDIR)/config.obj $(BUILDDIR)/crcombat.obj $(BUILDDIR)/creature.obj $(BUILDDIR)/main.obj $(BUILDDIR)/map.obj $(BUILDDIR)/objects.obj $(BUILDDIR)/player.obj $(BUILDDIR)/script.obj $(BUILDDIR)/shm.obj $(BUILDDIR)/skill.obj $(BUILDDIR)/thread.obj $(BUILDDIR)/time.obj $(BUILDDIR)/util.obj + $(CC) $(CFLAGS) $(LFLAGS) -o $@ $^ + +$(BUILDDIR)/config.obj: $(SRCDIR)/config.cc $(HEADERS) + @mkdir -p $(@D) + $(CC) -c $(CFLAGS) -o $@ $< + +$(BUILDDIR)/crcombat.obj: $(SRCDIR)/crcombat.cc $(HEADERS) + @mkdir -p $(@D) + $(CC) -c $(CFLAGS) -o $@ $< + +$(BUILDDIR)/creature.obj: $(SRCDIR)/creature.cc $(HEADERS) + @mkdir -p $(@D) + $(CC) -c $(CFLAGS) -o $@ $< + +$(BUILDDIR)/main.obj: $(SRCDIR)/main.cc $(HEADERS) + @mkdir -p $(@D) + $(CC) -c $(CFLAGS) -o $@ $< + +$(BUILDDIR)/map.obj: $(SRCDIR)/map.cc $(HEADERS) + @mkdir -p $(@D) + $(CC) -c $(CFLAGS) -o $@ $< + +$(BUILDDIR)/objects.obj: $(SRCDIR)/objects.cc $(HEADERS) + @mkdir -p $(@D) + $(CC) -c $(CFLAGS) -o $@ $< + +$(BUILDDIR)/player.obj: $(SRCDIR)/player.cc $(HEADERS) + @mkdir -p $(@D) + $(CC) -c $(CFLAGS) -o $@ $< + +$(BUILDDIR)/script.obj: $(SRCDIR)/script.cc $(HEADERS) + @mkdir -p $(@D) + $(CC) -c $(CFLAGS) -o $@ $< + +$(BUILDDIR)/shm.obj: $(SRCDIR)/shm.cc $(HEADERS) + @mkdir -p $(@D) + $(CC) -c $(CFLAGS) -o $@ $< + +$(BUILDDIR)/skill.obj: $(SRCDIR)/skill.cc $(HEADERS) + @mkdir -p $(@D) + $(CC) -c $(CFLAGS) -o $@ $< + +$(BUILDDIR)/thread.obj: $(SRCDIR)/thread.cc $(HEADERS) + @mkdir -p $(@D) + $(CC) -c $(CFLAGS) -o $@ $< + +$(BUILDDIR)/time.obj: $(SRCDIR)/time.cc $(HEADERS) + @mkdir -p $(@D) + $(CC) -c $(CFLAGS) -o $@ $< + +$(BUILDDIR)/util.obj: $(SRCDIR)/util.cc $(HEADERS) + @mkdir -p $(@D) + $(CC) -c $(CFLAGS) -o $@ $< + +.PHONY: clean +clean: + @rm -r $(BUILDDIR) |
