From 50e382e5efe6bdad568a507e7ec675e27e94d428 Mon Sep 17 00:00:00 2001 From: clsr Date: Sat, 28 Dec 2019 21:47:52 +0100 Subject: Clean up makefile --- .gitignore | 2 ++ COPYING | 3 +++ Makefile | 19 +++++++++++++++---- README.md | 2 +- config.def.mk | 40 ++++++++++++---------------------------- 5 files changed, 33 insertions(+), 33 deletions(-) create mode 100644 COPYING diff --git a/.gitignore b/.gitignore index d06a542..645a8d4 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,6 @@ *.o *.swp +*~ /dwmclock /config.mk +/compile_commands.json diff --git a/COPYING b/COPYING new file mode 100644 index 0000000..fd08ffe --- /dev/null +++ b/COPYING @@ -0,0 +1,3 @@ +This software is released into the public domain. +It is provided "as is", without warranties or conditions of any kind. +Anyone is free to use, modify, redistribute and do anything with this software. diff --git a/Makefile b/Makefile index 753018d..5133980 100644 --- a/Makefile +++ b/Makefile @@ -1,8 +1,19 @@ -include config.mk +CC? = cc +MAIN = dwmclock +SRC = dwmclock.c +OBJ = $(SRC:.c=.o) +CFLAGS := -std=c99 -Wall -Wextra -pedantic -Os $(shell pkg-config --cflags x11) $(CFLAGS) +LDFLAGS := $(shell pkg-config --libs x11) $(LDFLAGS) + +# install in /usr/local/bin +DESTDIR ?= / +PREFIX ?= /usr/local -MAIN=dwmclock -SRC=dwmclock.c -OBJ=$(SRC:.c=.o) +# install in ~/.local/bin +#DESTDIR ?= ~ +#PREFIX ?= /.local + +include config.mk all: $(SRC) $(MAIN) diff --git a/README.md b/README.md index e7b1e74..bf50b36 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ Show the time and current battery charge in the X root window name Requirements ------------ -- Xlib headers +- libX11 Installation diff --git a/config.def.mk b/config.def.mk index 0d5d03d..a9dfe19 100644 --- a/config.def.mk +++ b/config.def.mk @@ -1,43 +1,27 @@ # dwmclock settings # enable battery charge display -CFLAGS+=-DBATTERY +CFLAGS += -DBATTERY # set this to the correct path for your current system -CFLAGS+=-DENERGY_FULL=\"/sys/class/power_supply/BAT0/energy_full\" -CFLAGS+=-DENERGY_NOW=\"/sys/class/power_supply/BAT0/energy_now\" -CFLAGS+=-DSTATUS=\"/sys/class/power_supply/ADP1/online\" +CFLAGS += -DENERGY_FULL=\"/sys/class/power_supply/BAT0/energy_full\" +CFLAGS += -DENERGY_NOW=\"/sys/class/power_supply/BAT0/energy_now\" +CFLAGS += -DSTATUS=\"/sys/class/power_supply/BAT0/status\" # the string to match when the battery is charging; comment out to disable charging detection -CFLAGS+=-DCHARGING=\"1\\n\" +CFLAGS += -DCHARGING=\"Charging\\n\" # possible alternative on some systems -#CFLAGS+=-DENERGY_FULL=\"/sys/class/power_supply/BAT0/charge_full\" -#CFLAGS+=-DENERGY_NOW=\"/sys/class/power_supply/BAT0/charge_now\" -#CFLAGS+=-DSTATUS=\"/sys/class/power_supply/BAT0/status\" -#CFLAGS+=-DCHARGING=\"Charging\\n\" +#CFLAGS += -DENERGY_FULL=\"/sys/class/power_supply/BAT0/charge_full\" +#CFLAGS += -DENERGY_NOW=\"/sys/class/power_supply/BAT0/charge_now\" +#CFLAGS += -DSTATUS=\"/sys/class/power_supply/ADP1/online\" +#CFLAGS += -DCHARGING=\"1\\n\" # every how many seconds to refresh the battery charge display -CFLAGS+=-DBAT_REFRESH_SECONDS=10 +CFLAGS += -DBAT_REFRESH_SECONDS=10 # this is here for legacy reasons, ignore it -CFLAGS+=-DMUL=1 +CFLAGS += -DMUL=1 # sleep to the start of the next second instead of for 1s -CFLAGS+=-DEXACT_SLEEP - - -# make settings - -# default compiler -CC?=gcc - -# compiler flags -CFLAGS+=-std=c99 -Wall -Wextra -pedantic -Os $(shell pkg-config --cflags x11) -LDFLAGS+=$(shell pkg-config --libs x11) - -# default paths -DESTDIR?=/ -PREFIX?=/usr/local -#DESTDIR?=~ -#PREFIX?=/.local +CFLAGS += -DEXACT_SLEEP -- cgit