From a38f450534e7aca9b71f809d088bce5a5ddda5f5 Mon Sep 17 00:00:00 2001 From: Arsen Mirzaev Tatyano-Muradovich Date: Sun, 4 Jan 2026 14:19:46 +0500 Subject: [PATCH] created from `marketfucker/root` --- .gitignore | 5 ++++ LICENSE | 0 README.md | 0 includes/.gitkeep | 0 libraries/.gitkeep | 0 makefile | 70 ++++++++++++++++++++++++++++++++++++++++++++++ objects/.gitkeep | 0 source/.gitkeep | 0 8 files changed, 75 insertions(+) create mode 100644 .gitignore mode change 100644 => 100755 LICENSE mode change 100644 => 100755 README.md create mode 100644 includes/.gitkeep create mode 100644 libraries/.gitkeep create mode 100755 makefile create mode 100644 objects/.gitkeep create mode 100644 source/.gitkeep diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..7aa090b --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +includes/* +!includes/.gitkeep +objects/* +!objects/.gitkeep +bin diff --git a/LICENSE b/LICENSE old mode 100644 new mode 100755 diff --git a/README.md b/README.md old mode 100644 new mode 100755 diff --git a/includes/.gitkeep b/includes/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/libraries/.gitkeep b/libraries/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/makefile b/makefile new file mode 100755 index 0000000..5567c18 --- /dev/null +++ b/makefile @@ -0,0 +1,70 @@ +CC = gcc +SRC = source +OBJ = objects +LIB = libraries +SRC_LIB = $(SRC)/libraries +INC = includes +BIN = bin +TARGET = root +PREFIX ?= /usr/local +CFLAGS = -Wall -Wextra -std=c11 +LIBRARIES = +INCLUDES = \ + -I ./source + +DEPENDENCIES = $(shell find ./deps -maxdepth 2 -name Makefile -printf '%h\n' | grep -v 'unittest' | grep -v '^.$$') +SOURCES = $(shell find ./source -name '*.c') + +# Debug +ifeq ($(DEBUG), 1) + CFLAGS += -DDEBUG=1 -ggdb +endif + +# Release +ifeq ($(RELEASE), 1) + CFLAGS += -O2 +endif + +# Shared +ifeq ($(SHARED), 1) + SOURCES=$(shell find ./$(SRC_LIB) -name '*.c') + TARGET=my_lib +endif + +OBJECTS = $(addprefix $(OBJ)/,$(SOURCES:%.c=%.o)) + +.PHONY: all +all: dependencies source + +.PHONY: dependencies +dependencies: + echo "empty" + +.PHONY: source +source: $(OBJECTS) + @mkdir -p $(BIN) +ifeq ($(SHARED), 1) + $(CC) -shared -fPIC -o $(BIN)/$(TARGET).so $^ $(LIBRARIES) + ar -rcs $(BIN)/$(TARGET).a $^ +else + $(CC) $(CFLAGS) $(LIBRARIES) $^ -o $(BIN)/$(TARGET) +endif + # $(CC) -o $(TARGET) $(OBJECTS) $(CFLAGS) + +$(OBJ)/%.o: %.c + @mkdir -p $(dir $@) + $(CC) -c -o $@ $< $(CFLAGS) $(INCLUDES) + +.PHONY: clean +clean: + @rm -rf $(OBJ)/* 2> /dev/null + @rm -rf $(BIN)/* 2> /dev/null + @rm -rf $(INC)/* 2> /dev/null + +# .PHONY: install +# install: +# install $(TARGET) $(PREFIX)/bin + +# .PHONY: uninstall +# uninstall: +# @rm -f $(PREFIX)/bin/$(TARGET) 2> /dev/null diff --git a/objects/.gitkeep b/objects/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/source/.gitkeep b/source/.gitkeep new file mode 100644 index 0000000..e69de29