123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130 |
- #- aslstatus - async suckless status monitor -#
- include config.mk
- ifeq (${COMPONENTS},)
- COMPONENTS := $(wildcard components/*.c)
- COMPONENTS += $(wildcard lib/*.c)
- A_ALSA_C := components/volume/alsa.c
- A_PULSE_C := components/volume/pulse.c
- A_DEF_C := components/volume/default.c
- endif # COMPONENTS
- OBJ = ${COMPONENTS:.c=.o}
- X ?= 1
- XKB ?= 1
- AUDIO ?= ALSA
- # components that needs running X server
- NEED_X_SERVER_COM := keymap
- NEED_X_SERVER_DEF := -DNEED_X_SERVER=1
- NEED_X_SERVER = $(if \
- $(strip \
- $(foreach _,\
- ${NEED_X_SERVER_COM},\
- $(filter %/${_}.c,${COMPONENTS})\
- )),\
- ${NEED_X_SERVER_DEF},)
- SMART_CONFIG ?= 1
- ifeq (${X},1)
- LDLIBS += ${LDXCB}
- CPPFLAGS += -DUSE_X=1
- ifeq (${XKB},1)
- LDLIBS += ${LDXCB_XKB}
- CPPFLAGS += -DUSE_XKB=1
- else
- CPPFLAGS += -DUSE_XKB=0
- endif # XKB
- else
- CPPFLAGS += -DUSE_X=0
- CPPFLAGS += -DUSE_XKB=0
- endif # X
- .PHONY: all
- ifeq (${SMART_CONFIG},1)
- all: smart-conf
- include smart-config.mk
- else
- all: aslstatus
- endif
- ifeq (${AUDIO},ALSA)
- LDLIBS += ${LDALSA}
- CPPFLAGS += -DUSE_ALSA
- COMPONENTS += ${A_ALSA_C}
- endif # ALSA
- ifeq (${AUDIO},PULSE)
- LDLIBS += ${LDPULSE}
- CPPFLAGS += -DUSE_PULSE
- COMPONENTS += ${A_PULSE_C}
- endif # PULSE
- ifneq (${AUDIO},ALSA)
- ifneq (${AUDIO},PULSE)
- COMPONENTS += ${A_DEF_C}
- endif
- endif
- ifneq (,$(filter %tcc,${CC})) # if compiler is tcc
- # libraries and flags first, then files to link
- LINK_FLAGS = ${LDFLAGS} ${LDLIBS} ${CFLAGS} ${1}
- else
- # vice versa
- LINK_FLAGS = ${1} ${LDFLAGS} ${LDLIBS} ${CFLAGS}
- endif
- include deps.mk
- include build.mk
- aslstatus.o: CPPFLAGS += $(NEED_X_SERVER)
- config.o: config.h
- arch="$$(uname -m)" && $(LD) -m "elf_$${arch}" -r -b binary -o $@ $<
- %.o: %.c
- $(CC) -o $@ -c $< ${CFLAGS} ${WARNINGS} ${CPPFLAGS}
- aslstatus: aslstatus.o config.o ${OBJ}
- $(CC) -o $@ $(call LINK_FLAGS,$^)
- man/aslstatus.1: man/aslstatus.1.md
- pandoc --standalone --from=markdown $< --to=man -o $@
- .PHONY: man
- man: man/aslstatus.1
- .PHONY: install
- install: all
- mkdir -p "${DESTDIR}${PREFIX}/bin"
- cp -f aslstatus "${DESTDIR}${PREFIX}/bin"
- chmod 755 "${DESTDIR}${PREFIX}/bin/aslstatus"
- mkdir -p "${DESTDIR}${MANPREFIX}/man1"
- cp -f man/aslstatus.1 "${DESTDIR}${MANPREFIX}/man1"
- chmod 644 "${DESTDIR}${MANPREFIX}/man1/aslstatus.1"
- .PHONY: clean
- ifeq (${SMART_CONFIG},1)
- clean: smart-config-clean
- endif
- clean:
- rm -f aslstatus aslstatus.o config.o \
- $(wildcard lib/*.o components/*.o components/*/*.o)
- .PHONY: uninstall
- uninstall:
- rm -f "${DESTDIR}${PREFIX}/bin/aslstatus"
- rm -f "${DESTDIR}${MANPREFIX}/man1/aslstatus.1"
|