diff options
| author | flu0r1ne <flu0r1ne@flu0r1ne.net> | 2023-08-17 16:15:00 -0500 | 
|---|---|---|
| committer | flu0r1ne <flu0r1ne@flu0r1ne.net> | 2023-08-17 16:15:00 -0500 | 
| commit | b977caa5759685e2a8f969f099c1293cb810f07c (patch) | |
| tree | 5623a2bdd8d2f39e5ea643c75bda22295ae3a5c9 /makefile | |
| parent | 34779155d5b69b51aa301e7c111f95ea9c840589 (diff) | |
| download | wg2nd-b977caa5759685e2a8f969f099c1293cb810f07c.tar.xz wg2nd-b977caa5759685e2a8f969f099c1293cb810f07c.zip | |
add install paths to makefile
Diffstat (limited to 'makefile')
| -rw-r--r-- | makefile | 27 | 
1 files changed, 23 insertions, 4 deletions
| @@ -1,3 +1,11 @@ +ifeq ($(PREFIX),) +	PREFIX := /usr/local +endif + +ifeq ($(BINDIR),) +	BINDIR := /sbin +endif +  # Compiler  CXX = g++ @@ -32,13 +40,13 @@ OBJ_DIR = obj  DEBUG_OBJ_DIR = obj/debug  # Target executable -TARGET = wg2sd +CMD = wg2sd  # Build rules  all: CXXFLAGS += $(RELEASE_FLAGS)  all: targets -targets: $(TARGET) +targets: $(CMD)  tests: $(TEST_TARGETS) @@ -46,7 +54,7 @@ debug: CXXFLAGS += $(DEBUGFLAGS)  debug: OBJ_DIR = $(DEBUG_OBJ_DIR)  debug: tests targets -$(TARGET): $(addprefix $(OBJ_DIR)/, $(OBJECTS)) +$(CMD): $(addprefix $(OBJ_DIR)/, $(OBJECTS))  	$(CXX) $(CXXFLAGS) $^ $(LDFLAGS) -o $@  $(OBJ_DIR)/%.o: $(SRC_DIR)/%.cpp | $(OBJ_DIR) @@ -58,16 +66,27 @@ $(TEST_DIR)/%: $(TEST_DIR)/%.cpp $(addprefix $(OBJ_DIR)/, wg2sd.o) | $(OBJ_DIR)  $(OBJ_DIR) $(DEBUG_OBJ_DIR):  	mkdir -p $@ +install: +	mkdir -p $(DESTDIR)$(PREFIX)$(BINDIR)/ +	install -m 755 $(CMD) $(DESTDIR)$(PREFIX)$(BINDIR)/ + +uninstall: +	rm -rf $(DESTDIR)$(PREFIX)$(BINDIR)/$(CMD) +  # Clean rule  clean:  	rm -rf $(OBJ_DIR) $(DEBUG_OBJ_DIR) $(TARGET) $(TEST_TARGETS) +.PHONY: install uninstall all clean targets tests +  # Help rule  help:  	@echo "Available targets:"  	@echo "  all (default)   : Build the project" -	@echo "  release         : Build the project with release flags"  	@echo "  tests           : Build the tests"  	@echo "  debug           : Build the project and tests with debug flags"  	@echo "  clean           : Remove all build artifacts" +	@echo "  install         : install build executables" +	@echo "  uninstall       : uninstall build executables"  	@echo "  help            : Display this help message" + | 
