Files

33 lines
819 B
Makefile

# fileutils — build
# Compiles every C/C++ utility in src/ into bin/.
# Termux-compatible: plain cc/c++ (gcc on Linux, clang on Termux), standard
# library and POSIX APIs only — no exotic libraries, no Linux-only calls
# Android lacks (no ncurses, no <sys/sysinfo.h>; read /proc instead).
# Bash/Python utilities live directly in bin/ as executable files.
CC ?= cc
CXX ?= c++
CFLAGS ?= -O2 -Wall -Wextra -std=c11
CXXFLAGS ?= -O2 -Wall -Wextra -std=c++17
SRC_C := $(wildcard src/*.c)
SRC_CPP := $(wildcard src/*.cpp)
BIN_C := $(patsubst src/%.c,bin/%,$(SRC_C))
BIN_CPP := $(patsubst src/%.cpp,bin/%,$(SRC_CPP))
BINS := $(BIN_C) $(BIN_CPP)
all: $(BINS)
bin/%: src/%.c
@mkdir -p bin
$(CC) $(CFLAGS) -o $@ $<
bin/%: src/%.cpp
@mkdir -p bin
$(CXX) $(CXXFLAGS) -o $@ $<
clean:
rm -f $(BINS)
.PHONY: all clean