Files
liboptionscxx/Makefile
2026-03-29 21:45:52 -07:00

47 lines
892 B
Makefile

CXX ?= g++
VERSION := 0.0.2
TARGET_NOVERSION := liboptions.so
TARGET := $(TARGET_NOVERSION).$(VERSION)
SRCS := $(wildcard *.cpp)
OBJS := $(SRCS:.cpp=.o)
CXXFLAGS := -std=c++17 -fPIC -shared
OPTFLAGS := -O3
DBGFLAGS := -g
LDFLAGS :=
# Default build
all: release
release: CXXFLAGS += $(OPTFLAGS)
release: $(TARGET)
debug: CXXFLAGS += $(DBGFLAGS)
debug: $(TARGET)
# Linker
$(TARGET): $(OBJS)
$(CXX) $(CXXFLAGS) -o $@ $^ $(LDFLAGS)
# Compiler
%.o: %.cpp
$(CXX) $(CXXFLAGS) -c $< -o $@
clean:
rm -f $(OBJS) $(TARGET_NOVERSION) $(TARGET_NOVERSION).*
install:
cp $(TARGET) /usr/lib/$(TARGET)
cp options.h /usr/include/options.h
cp options_headeronly.h /usr/include/options_headeronly.h
ln -s /usr/lib/$(TARGET) /usr/lib/$(TARGET_NOVERSION)
uninstall:
unlink /usr/lib/$(TARGET_NOVERSION)
rm /usr/lib/$(TARGET)
rm /usr/include/options.h
rm /usr/include/options_headeronly.h