librw/Makefile

34 lines
903 B
Makefile
Raw Normal View History

# null, opengl
BUILD=null
# e.g. null -> -DRW_NULL
BUILDDEF:=$(shell echo $(BUILD) | tr a-z A-Z | sed 's/^/-DRW_/')
BUILDDIR=build-$(BUILD)
2014-12-23 14:59:14 +00:00
SRCDIR=src
2016-01-10 19:10:53 +00:00
#SRC := $(patsubst %.cpp,$(SRCDIR)/%.cpp, $(wildcard *.cpp))
2016-06-26 10:16:33 +01:00
SRC := $(wildcard $(SRCDIR)/*.cpp $(SRCDIR)/*/*.cpp)
2014-12-23 14:59:14 +00:00
OBJ := $(patsubst $(SRCDIR)/%.cpp,$(BUILDDIR)/%.o,$(SRC))
2014-12-24 10:38:25 +00:00
DEP := $(patsubst $(SRCDIR)/%.cpp,$(BUILDDIR)/%.d,$(SRC))
2015-08-27 15:45:54 +01:00
INC := -I/usr/local/include
CFLAGS=-Wall -Wextra -g $(BUILDDEF) -fno-diagnostics-show-caret \
-Wno-parentheses -Wno-invalid-offsetof \
-Wno-unused-parameter -Wno-sign-compare
LIB=librw-$(BUILD).a
2014-12-23 14:59:14 +00:00
$(LIB): $(OBJ)
2014-12-23 14:59:14 +00:00
ar scr $@ $(OBJ)
$(BUILDDIR)/%.o: $(SRCDIR)/%.cpp
2015-01-18 18:35:23 +00:00
@mkdir -p $(@D)
2015-08-27 15:45:54 +01:00
$(CXX) $(CFLAGS) $(INC) -c $< -o $@
2014-12-23 14:59:14 +00:00
$(BUILDDIR)/%.d: $(SRCDIR)/%.cpp
2015-01-18 18:35:23 +00:00
@mkdir -p $(@D)
2015-08-27 15:45:54 +01:00
$(CXX) -MM -MT '$(patsubst $(SRCDIR)/%.cpp,$(BUILDDIR)/%.o,$<)' $(CFLAGS) $(INC) $< > $@
2014-12-23 14:59:14 +00:00
clean:
2016-01-10 19:10:53 +00:00
echo $(SRC)
rm -rf $(BUILDDIR)/*
2014-12-23 14:59:14 +00:00
-include $(DEP)