diff --git a/Makefile b/Makefile index 53ac4d0..163d6fd 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,23 @@ -all: build +CC = gcc +CFLAGS = -Wall -Wextra -O2 +TARGET = tinyfetch +SRC = src/tinyfetch.c +PREFIX = /usr/local -build: - gcc src/tinyfetch.c -o main +all: $(TARGET) + +$(TARGET): $(SRC) + $(CC) $(CFLAGS) $(SRC) -o $(TARGET) + +clean: + rm -f $(TARGET) + +install: $(TARGET) + mkdir -p $(PREFIX)/bin + cp -f $(TARGET) $(PREFIX)/bin + chmod 755 $(PREFIX)/bin/$(TARGET) + +uninstall: + rm -f $(PREFIX)/bin/$(TARGET) + +.PHONY: clean install uninstall diff --git a/README.md b/README.md index 7210950..573aadf 100644 --- a/README.md +++ b/README.md @@ -2,16 +2,32 @@ A simple fetch in C which is tiny and fast.. it takes 0.001 to 0.004s to fetch ## Depends -- only c compiler and `TERM`, `LANG`, `USER`, `SHELL` environmental variables +- `TERM`, `LANG`, `USER`, `SHELL` environmental variables +- gcc +- make ## Installation +1. **Clone the repository:** + ```bash + git clone [https://github.com/abrik1/tinyfetch](https://github.com/abrik1/tinyfetch) + cd tinyfetch + ``` + +2. **Configuration (Optional):** + Edit src/config.h to customize the output. + +3. **Build:** +```bash +make +``` +4. **Install:** +```bash +sudo make install ``` -$ git clone https://github.com/abrik1/tinyfetch -$ cd tinyfetch/src -$ vim config.h # if you want to change config -$ gcc tinyfetch.c -o tinyfetch -$ ./tinyfetch +## Uninstall +```bash +sudo make uninstall ``` ## Preview diff --git a/tinyfetch b/tinyfetch new file mode 100755 index 0000000..c05cde1 Binary files /dev/null and b/tinyfetch differ