Initial Commit
This commit is contained in:
45
Makefile
Normal file
45
Makefile
Normal file
@@ -0,0 +1,45 @@
|
||||
CXX ?= g++
|
||||
|
||||
VERSION := 0.0.1
|
||||
|
||||
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
|
||||
ln -s /usr/lib/$(TARGET) /usr/lib/$(TARGET_NOVERSION)
|
||||
|
||||
uninstall:
|
||||
unlink /usr/lib/$(TARGET_NOVERSION)
|
||||
rm /usr/lib/$(TARGET)
|
||||
rm /usr/include/options.h
|
||||
Reference in New Issue
Block a user