mirror of
https://github.com/javalsai/lidm.git
synced 2026-02-27 03:50:44 +01:00
* chore(organization): allow nested header and c files * feat: add shell login "middleware" & etc: * lidm now calls `bash` (or other shells, depends on PACKAGE cfg) in login mode as a session wrapper to source most env (can be disabled) * this fixes a lot of env problems with all `/etc/profile` and more Extra: * implemented a musl compatible version of `execvpe` and now lidm should search for PATH everywhere it needs to * `search_path` now also checks if the found binary is properly executable * lidm now uses `confstr` for a decent PATH default if none is found * logs are unbuffered for cases where debug logs appear empty (exit without handlers moment) * chore: one-time evaluate certain makefile vars --------- Co-authored-by: grialion <48643945+grialion@users.noreply.github.com>
72 lines
2.0 KiB
Makefile
72 lines
2.0 KiB
Makefile
VERSION := 2.0.0
|
|
.DEFAULT_GOAL := lidm
|
|
|
|
CDIR = src
|
|
LDIR = lib
|
|
IDIR = include
|
|
ODIR = dist
|
|
|
|
PREFIX = /usr/local
|
|
|
|
INFO_GIT_REV ?= $(shell git describe --long --tags --always || echo '?')
|
|
INFO_GIT_REV := $(INFO_GIT_REV)
|
|
INFO_BUILD_TS ?= $(shell date +%s)
|
|
INFO_BUILD_TS := $(INFO_BUILD_TS)
|
|
|
|
CFLAGS ?= -O3 -Wall -Wextra -fdata-sections -ffunction-sections
|
|
# C PreProcessor flags, not C Plus Plus
|
|
CPPFLAGS ?=
|
|
_DFLAGS?= \
|
|
-DLIDM_VERSION=\"$(VERSION)\" \
|
|
-DLIDM_GIT_REV=\"$(INFO_GIT_REV)\" \
|
|
-DLIDM_BUILD_TS=$(INFO_BUILD_TS)
|
|
ALLFLAGS = $(_DFLAGS) $(CFLAGS) $(CPPFLAGS) -I$(IDIR)
|
|
LDFLAGS ?= -Wl,--gc-sections
|
|
|
|
LIBS = -lpam
|
|
|
|
# includes all headers in `$(IDIR)` and compiles everything in `$(CDIR)`
|
|
DEPS = $(wildcard $(IDIR)/*.h $(IDIR)/**/*.h)
|
|
_SOURCES = $(wildcard $(CDIR)/*.c) $(wildcard $(CDIR)/**/*.c)
|
|
OBJ = $(patsubst $(CDIR)/%.c,$(ODIR)/%.o,$(_SOURCES))
|
|
|
|
$(ODIR)/%.o: $(CDIR)/%.c $(DEPS)
|
|
@mkdir -p $(dir $@)
|
|
$(CC) -c -o $@ $< $(ALLFLAGS)
|
|
|
|
lidm: $(OBJ)
|
|
$(CC) -o $@ $^ $(ALLFLAGS) $(LIBS) $(LDFLAGS)
|
|
|
|
clean:
|
|
rm -rf $(ODIR) lidm
|
|
|
|
install: lidm
|
|
mkdir -p ${DESTDIR}${PREFIX}/bin ${DESTDIR}${PREFIX}/share/man/man{1,5}
|
|
install -Dm755 ./lidm ${DESTDIR}${PREFIX}/bin/
|
|
[ -f ${DESTDIR}/etc/lidm.ini ] || install -Dm644 ./themes/default.ini ${DESTDIR}/etc/lidm.ini
|
|
install -Dm644 ./assets/man/lidm.1 ${DESTDIR}${PREFIX}/share/man/man1/
|
|
install -Dm644 ./assets/man/lidm-config.5 ${DESTDIR}${PREFIX}/share/man/man5/
|
|
|
|
uninstall: uninstall-service
|
|
rm -rf ${DESTDIR}${PREFIX}/bin/lidm ${DESTDIR}/etc/lidm.ini
|
|
rm -rf ${DESTDIR}${PREFIX}/share/man/man{1/lidm.1,5/lidm-config.5}.gz
|
|
|
|
include services.mk
|
|
|
|
pre-commit:
|
|
codespell
|
|
prettier -c "**/*.md"
|
|
git ls-files "*.sh" "*/PKGBUILD" | xargs shellcheck --shell=bash
|
|
clang-format -i $$(git ls-files "*.c" "*.h")
|
|
git ls-files -z "*.c" "*.h" | \
|
|
parallel -j$$(nproc) -q0 --no-notice --will-cite --tty clang-tidy -warnings-as-errors=\* --quiet |& \
|
|
grep -v "warnings generated." || true
|
|
|
|
print-version:
|
|
@echo $(VERSION)
|
|
|
|
.PHONY: clean \
|
|
install uninstall \
|
|
pre-commit \
|
|
print-version
|