commit 8f2f0f5ff6fc903dfe04eca44a53419a319ca80a
parent 5a86694d2ead6de5874bd2dc26fc7c531b81b9f6
Author: lumidify <nobody@lumidify.org>
Date: Mon, 6 Apr 2020 12:23:49 +0200
Clean up Makefile
The header files are still a bit messed up...
Diffstat:
8 files changed, 30 insertions(+), 25 deletions(-)
diff --git a/Makefile b/Makefile
@@ -1,7 +1,15 @@
LIBS = -lm `pkg-config --libs x11 harfbuzz fontconfig fribidi`
STD = -std=c99
-FLAGS = -g -w -fcommon -Wall -Werror -Wextra `pkg-config --cflags x11 harfbuzz fontconfig fribidi`#-pedantic
-CFILES = text-hb.c ltk.c ini.c grid.c button.c test1.c
+CFLAGS = -g -w -fcommon -Wall -Werror -Wextra `pkg-config --cflags x11 harfbuzz fontconfig fribidi`#-pedantic
+OBJ = text-hb.o ltk.o ini.o grid.o button.o test1.o
-all: test1.c
- gcc $(STD) $(FLAGS) $(LIBS) $(CFILES) -o test
+test1: $(OBJ)
+ gcc $(STD) -o $@ $> $(CFLAGS) $(LIBS)
+
+%.o: %.c $(DEPS)
+ $(CC) -c -o $@ $< $(CFLAGS)
+
+.PHONY: clean
+
+clean:
+ rm -f text-hb.o ltk.o ini.o grid.o button.o test1.o test1
diff --git a/button.c b/button.c
@@ -22,7 +22,6 @@
*/
#include "ltk.h"
-#include "text-hb.h"
#include "button.h"
void ltk_button_ini_handler(LtkTheme *theme, const char *prop, const char *value)
@@ -142,6 +141,8 @@ LtkButton *ltk_create_button(LtkWindow *window, const char *text, void (*callbac
ltk_fatal("ERROR: Unable to allocate memory for LtkButton.\n");
}
+ /* FIXME: shouldn't widget already have been allocated by allocating space for
+ the whole button? */
button->widget = ltk_create_widget(window, <k_draw_button, <k_destroy_button, 1);
button->widget.mouse_release = <k_button_mouse_release;
diff --git a/grid.c b/grid.c
@@ -23,7 +23,7 @@
/* TODO: remove_widget function that also adjusts static width */
-#include "ltk.h"
+#include "grid.h"
void ltk_set_row_weight(LtkGrid * grid, int row, int weight)
{
diff --git a/ltk.c b/ltk.c
@@ -21,7 +21,9 @@
* SOFTWARE.
*/
-#include "text-hb.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include "ini.h"
#include "ltk.h"
void ltk_init(const char *theme_path)
diff --git a/ltk.h b/ltk.h
@@ -24,13 +24,10 @@
#ifndef _LTK_H_
#define _LTK_H_
-#include <stdio.h>
-#include <stdlib.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
-#include "ini.h"
#include "khash.h"
-#include "stb_truetype.h"
+#include "text-hb.h"
typedef struct {
int x;
diff --git a/stb_truetype.h b/stb_truetype.h
@@ -1,5 +1,5 @@
-#ifndef BOB
-#define BOB
+#ifndef _STB_TRUETYPE_H_
+#define _STB_TRUETYPE_H_
// stb_truetype.h - v1.13 - public domain
// authored from 2009-2016 by Sean Barrett / RAD Game Tools
//
diff --git a/text-hb.c b/text-hb.c
@@ -25,13 +25,10 @@
#include <stdlib.h>
#include <stdint.h>
#include <limits.h>
-#include <X11/Xlib.h>
-#include <X11/Xutil.h>
-#include <fontconfig/fontconfig.h>
+#define STB_TRUETYPE_IMPLEMENTATION
+#include "stb_truetype.h" /* http://nothings.org/stb/stb_truetype.h */
#include "ltk.h"
-#include "khash.h"
#include "text-hb.h"
-#include <fribidi.h>
/* These unicode routines are taken from
* https://github.com/JeffBezanson/cutef8 */
diff --git a/text-hb.h b/text-hb.h
@@ -21,17 +21,17 @@
* SOFTWARE.
*/
-#ifndef TEXT_HB_H
-#define TEXT_HB_H
+#ifndef _TEXT_HB_H_
+#define _TEXT_HB_H_
-#include <harfbuzz/hb.h>
-#include <harfbuzz/hb-ot.h>
-#define STB_TRUETYPE_IMPLEMENTATION
-#include "stb_truetype.h" /* http://nothings.org/stb/stb_truetype.h */
-#include "khash.h"
#include <X11/Xlib.h>
+#include <X11/Xutil.h>
+#include "stb_truetype.h" /* http://nothings.org/stb/stb_truetype.h */
#include <fontconfig/fontconfig.h>
+#include "khash.h"
#include <fribidi.h>
+#include <harfbuzz/hb.h>
+#include <harfbuzz/hb-ot.h>
typedef struct {
stbtt_fontinfo info;