migrate tstatus to an object-based compiliation format
This commit is contained in:
parent
d421df5a0b
commit
c588f3ae65
15
Makefile
15
Makefile
|
@ -1,8 +1,13 @@
|
||||||
tstatus:
|
CC = cc
|
||||||
cc tstatus.c -o tstatus -lxcb -lasound -Wall -Wextra -std=c99
|
CFLAGS = -Wall -Wextra -Wno-missing-field-initializers -std=c99
|
||||||
|
LDFLAGS = -lxcb -lasound
|
||||||
|
OBJFILES = alsa.o battery.o bspwm.o datetime.o file.o thermal.o tstatus.o
|
||||||
|
TARGET = tstatus
|
||||||
|
|
||||||
debug:
|
all: $(TARGET)
|
||||||
cc tstatus.c -o tstatus -lxcb -Wall -Wextra -std=c99 -ggdb
|
|
||||||
|
$(TARGET): $(OBJFILES)
|
||||||
|
$(CC) $(CFLAGS) -o $(TARGET) $(OBJFILES) $(LDFLAGS)
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm tstatus
|
rm -f $(OBJFILES) $(TARGET) *~
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#include "module.h"
|
#include "module.h"
|
||||||
#include "file.c"
|
#include "file.h"
|
||||||
#include "battery.h"
|
#include "battery.h"
|
||||||
|
|
||||||
int battery_update(struct module *module) {
|
int battery_update(struct module *module) {
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
#define BATTERY_PRE "/sys/class/power_supply/"
|
#define BATTERY_PRE "/sys/class/power_supply/"
|
||||||
#define BATTERY_CAP "/capacity"
|
#define BATTERY_CAP "/capacity"
|
||||||
|
|
||||||
int battery_module(struct module *module);
|
int battery_update(struct module *module);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
#define TSTATUS_BATTERY_H
|
#define TSTATUS_BATTERY_H
|
||||||
|
|
2
bspwm.h
2
bspwm.h
|
@ -24,6 +24,8 @@
|
||||||
* modifications made by randomuser for use in tstatus
|
* modifications made by randomuser for use in tstatus
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#define LENGTH(x) (sizeof(x) / sizeof(*x))
|
||||||
|
|
||||||
#define RUNTIME_DIR_ENV "XDG_RUNTIME_DIR"
|
#define RUNTIME_DIR_ENV "XDG_RUNTIME_DIR"
|
||||||
#define SOCKET_PATH_TPL "/tmp/bspwm%s_%i_%i-socket"
|
#define SOCKET_PATH_TPL "/tmp/bspwm%s_%i_%i-socket"
|
||||||
#define SOCKET_ENV_VAR "BSPWM_SOCKET"
|
#define SOCKET_ENV_VAR "BSPWM_SOCKET"
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
|
||||||
|
#include "module.h"
|
||||||
#include "datetime.h"
|
#include "datetime.h"
|
||||||
|
|
||||||
int datetime_update(struct module *module) {
|
int datetime_update(struct module *module) {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/* see LICENSE file for details on license */
|
/* see LICENSE file for details on license */
|
||||||
#ifndef TSTATUS_TIMEDATE_H
|
#ifndef TSTATUS_TIMEDATE_H
|
||||||
|
|
||||||
int timedate_update(struct module *module);
|
int datetime_update(struct module *module);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
#define TSTATUS_TIMEDATE_H
|
#define TSTATUS_TIMEDATE_H
|
||||||
|
|
3
file.c
3
file.c
|
@ -1,6 +1,9 @@
|
||||||
/* see LICENSE file for details on license */
|
/* see LICENSE file for details on license */
|
||||||
#ifndef TSTATUS_FILE_C
|
#ifndef TSTATUS_FILE_C
|
||||||
|
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <stdio.h>
|
||||||
#include "file.h"
|
#include "file.h"
|
||||||
|
|
||||||
void populate_buffer(char *buffer, char pattern) {
|
void populate_buffer(char *buffer, char pattern) {
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
/* see LICENSE file for details on license */
|
/* see LICENSE file for details on license */
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#include "module.h"
|
#include "module.h"
|
||||||
#include "file.c"
|
#include "file.h"
|
||||||
#include "thermal.h"
|
#include "thermal.h"
|
||||||
|
|
||||||
int convert_milli_to_reg(int millidegree) {
|
int convert_milli_to_reg(int millidegree) {
|
||||||
|
|
13
tstatus.c
13
tstatus.c
|
@ -1,14 +1,13 @@
|
||||||
/* see LICENSE file for details on license */
|
/* see LICENSE file for details on license */
|
||||||
|
#define _POSIX_C_SOURCE 2
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
#define LENGTH(x) (sizeof(x) / sizeof(*x))
|
|
||||||
|
|
||||||
#include "module.h"
|
#include "module.h"
|
||||||
#include "bspwm.c"
|
#include "bspwm.h"
|
||||||
#include "battery.c"
|
#include "battery.h"
|
||||||
#include "thermal.c"
|
#include "thermal.h"
|
||||||
#include "datetime.c"
|
#include "datetime.h"
|
||||||
#include "alsa.c"
|
#include "alsa.h"
|
||||||
|
|
||||||
struct module table[] = {
|
struct module table[] = {
|
||||||
{0, 10, bspwm_update, {'\0'}},
|
{0, 10, bspwm_update, {'\0'}},
|
||||||
|
|
Loading…
Reference in New Issue