Browse Source

Don't ignore makefile

master
Zack Marvel 1 year ago
parent
commit
a203396616
2 changed files with 62 additions and 48 deletions
  1. +0
    -48
      .gitignore
  2. +62
    -0
      Makefile

+ 0
- 48
.gitignore View File

@@ -35,51 +35,3 @@
*.app
nbt_dump
test_nbt

# Autotools
# http://www.gnu.org/software/automake

/Makefile.in
Makefile
/ar-lib
/mdate-sh
/py-compile
/test-driver
/ylwrap

# http://www.gnu.org/software/autoconf

autom4te.cache
/autoscan.log
/autoscan-*.log
/aclocal.m4
/compile
/config.guess
/config.h.in
/config.h
/config.log
/config.status
/config.sub
/configure
/configure.scan
/depcomp
/install-sh
/missing
/stamp-h1

# https://www.gnu.org/software/libtool/

/ltmain.sh
libtool

# http://www.gnu.org/software/texinfo

/texinfo.tex

# http://www.gnu.org/software/m4/

m4/libtool.m4
m4/ltoptions.m4
m4/ltsugar.m4
m4/ltversion.m4
m4/lt~obsolete.m4

+ 62
- 0
Makefile View File

@@ -0,0 +1,62 @@

EXE = nbt_dump

TEST_EXE = test_nbt

STATIC_LIB = libnbtpp.a

SRCS = \
src/nbt_dump.cpp \
src/nbt.cpp \

OBJS := $(SRCS:%.cpp=%.o)

INCDIRS = -Iinclude

TEST_SRCS = \
test/test_main.cpp \
test/test_nbt.cpp \
test/test_swaps.cpp \

CXXFLAGS += -std=gnu++14 -Wall -MD $(INCDIRS)

TEST_OBJS := $(TEST_SRCS:%.cpp=%.o)

TEST_INCDIRS = -Ilib/Catch2/single_include

TEST_CXXFLAGS := $(CXXFLAGS) $(TEST_INCDIRS)

DEPS := $(SRCS:%.cpp=%.d) $(TEST_SRCS:%.cpp=%.d)

all: $(EXE) $(STATIC_LIB)

.PHONY: test
test: $(TEST_EXE) test_data

$(EXE): src/nbt_dump.o $(STATIC_LIB)
$(CXX) $(LDFLAGS) -o [email protected] $^

$(STATIC_LIB): src/nbt.o
ar rcs [email protected] $^

$(TEST_OBJS): CXXFLAGS += $(TEST_CXXFLAGS)

$(TEST_EXE): $(TEST_OBJS) $(STATIC_LIB)
$(CXX) $(LDFLAGS) -o [email protected] $^

.PHONY: test_data
test_data:
make -C test/data



.PHONY: clean
clean:
rm -f $(EXE) $(STATIC_LIB) $(OBJS) $(TEST_EXE) $(TEST_OBJS) $(DEPS)
make -C test/data clean

.PHONY: tags
tags:
ctags -R src include test

-include $(DEPS)

Loading…
Cancel
Save