aboutsummaryrefslogtreecommitdiff
path: root/experimental/Makefile
diff options
context:
space:
mode:
authorB. Stack <bgstack15@gmail.com>2022-09-30 16:38:40 -0400
committerB. Stack <bgstack15@gmail.com>2022-09-30 16:40:46 -0400
commit29fa73d2f5013c9502934bc8252014a211d7f7a8 (patch)
tree33a0854ed05537ca4515f784f84889c5e0ee77b6 /experimental/Makefile
parentWIP: minimum viable product for status.c (diff)
downloadkeyboard-leds-trayicons-29fa73d2f5013c9502934bc8252014a211d7f7a8.tar.gz
keyboard-leds-trayicons-29fa73d2f5013c9502934bc8252014a211d7f7a8.tar.bz2
keyboard-leds-trayicons-29fa73d2f5013c9502934bc8252014a211d7f7a8.zip
added major C improvements
* use libinih to read config file * handle SIGPIPE gracefully (when a trayicon exits) * exit when both trayicons have exited I wanted to try using libini-config5 but it was not documented at all, and I need useful examples.
Diffstat (limited to 'experimental/Makefile')
-rw-r--r--experimental/Makefile36
1 files changed, 30 insertions, 6 deletions
diff --git a/experimental/Makefile b/experimental/Makefile
index 2bb7fca..17c9660 100644
--- a/experimental/Makefile
+++ b/experimental/Makefile
@@ -20,39 +20,63 @@ CC = gcc
CXXFLAGS = -g -std=c++17 -Wall -Weffc++ -Wextra -Wsign-conversion -Werror
CCFLAGS = -g -Wno-deprecated-declarations \
`pkg-config --cflags x11` \
- `pkg-config --cflags gtk+-3.0`
+ `pkg-config --cflags gtk+-3.0` \
+ `pkg-config --cflags inih` \
+ $(DEBUGFLAGS)
+CCFLAGS2 = -g -Wsign-conversion -Werror \
+ `pkg-config --cflags inih`
# to remove all debug symbols: -s
# to add full debug symbols: -g
LDFLAGS = -g \
`pkg-config --libs x11` \
- `pkg-config --libs gtk+-3.0`
+ `pkg-config --libs gtk+-3.0` \
+ `pkg-config --libs inih`
+LDFLAGS2 = -g \
+ `pkg-config --libs inih`
+
+ifneq (,$(DEBUG))
+CCFLAGS+=-DDEBUG=1
+endif
src = $(wildcard *.c)
+src := $(filter-out readconf.c, $(src))
+#src2 = $(wildcard read*.c)
obj = $(src:.c=.o)
+#obj2 = $(src2:.c=.o)
BUILD_DIR ?= .
-OUTEXE = status
+OUTEXE = keyboard-leds-trayicons
+#OUTEXE2 = readconf
-all: $(OUTEXE)
+all: $(OUTEXE) $(OUTEXE2)
+#all: $(OUTEXE)
$(obj):
+#$(obj2):
+
$(BUILD_DIR)/%.o: %.c
$(CC) -c $(CCFLAGS) -o $@ $<
+#$(BUILD_DIR)/readconf.o: readconf.c
+# $(CC) -c $(CCFLAGS2) -o $@ $<
+
# link
$(OUTEXE): $(obj)
$(CC) -o $@ $^ $(LDFLAGS)
+#$(OUTEXE2): $(obj2)
+# $(CC) -o $@ $^ $(LDFLAGS2)
+
.PHONY: clean cleanall list
list:
@$(MAKE) -pRrq -f $(lastword $(MAKEFILE_LIST)) : 2>/dev/null | ${awkbin} -v RS= -F: '/^# File/,/^# Finished Make data base/ {if ($$1 !~ "^[#.]") {print $$1}}' | ${sortbin} | ${grepbin} -E -v -e '^[^[:alnum:]]' -e '^$@$$' -e '\.(cp*|o)'
clean:
- rm -f $(obj)
+ rm -f $(obj) $(obj2)
cleanall:
- rm -f $(obj) $(OUTEXE)
+ rm -f $(obj) $(OUTEXE) $(obj2) $(OUTEXE2)
bgstack15