mirror of
https://github.com/lbonn/rofi
synced 2024-11-26 13:50:27 +00:00
Restructure a bit.
This commit is contained in:
parent
9068ddc3b2
commit
06039b8c9c
6 changed files with 36 additions and 18 deletions
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
*.swp
|
||||||
|
build/
|
36
Makefile
36
Makefile
|
@ -1,15 +1,25 @@
|
||||||
CFLAGS?=-Wall -Wextra -O3
|
CFLAGS?=-Wall -Wextra -O3
|
||||||
|
|
||||||
|
PROGRAM=simpleswitcher
|
||||||
|
|
||||||
|
|
||||||
PREFIX?=$(DESTDIR)/usr
|
PREFIX?=$(DESTDIR)/usr
|
||||||
BINDIR?=$(PREFIX)/bin
|
BINDIR?=$(PREFIX)/bin
|
||||||
MANDIR?=$(PREFIX)/share/man/man1
|
MANDIR?=$(PREFIX)/share/man/man1
|
||||||
|
|
||||||
SOURCES=$(wildcard *.c)
|
BUILD_DIR=build
|
||||||
OBJECTS=$(SOURCES:%.c=%.o)
|
SOURCE_DIR=source
|
||||||
|
DOC_DIR=doc
|
||||||
|
|
||||||
|
SOURCES=$(wildcard $(SOURCE_DIR)/*.c)
|
||||||
|
OBJECTS=$(SOURCES:$(SOURCE_DIR)/%.c=$(BUILD_DIR)/%.o)
|
||||||
|
HEADERS=$(wildcard include/*.h)
|
||||||
|
|
||||||
MANPAGE_PATH=$(MANDIR)/simpleswitcher.1.gz
|
MANPAGE_PATH=$(MANDIR)/simpleswitcher.1.gz
|
||||||
|
|
||||||
CFLAGS+=-DMANPAGE_PATH="\"$(MANPAGE_PATH)\""
|
CFLAGS+=-DMANPAGE_PATH="\"$(MANPAGE_PATH)\""
|
||||||
CFLAGS+=-std=c99
|
CFLAGS+=-std=c99
|
||||||
|
CFLAGS+=-Iinclude/
|
||||||
|
|
||||||
# Check deps.
|
# Check deps.
|
||||||
ifeq (${DEBUG},1)
|
ifeq (${DEBUG},1)
|
||||||
|
@ -43,22 +53,28 @@ $(info I3 mode is enabled)
|
||||||
CFLAGS+=-DI3 -I${PREFIX}/include/
|
CFLAGS+=-DI3 -I${PREFIX}/include/
|
||||||
endif
|
endif
|
||||||
|
|
||||||
all: normal
|
all: $(BUILD_DIR)/$(PROGRAM)
|
||||||
|
|
||||||
|
$(BUILD_DIR):
|
||||||
|
mkdir -p $@
|
||||||
|
# Objects depend on header files and makefile too.
|
||||||
|
|
||||||
normal: $(OBJECTS) | Makefile
|
$(BUILD_DIR)/%.o: $(SOURCE_DIR)/%.c | Makefile $(HEADERS) $(BUILD_DIR)
|
||||||
$(CC) -o simpleswitcher $^ $(LDADD) $(LDFLAGS)
|
$(CC) $(CFLAGS) -c -o $@ $^
|
||||||
|
|
||||||
install: normal install-man
|
$(BUILD_DIR)/$(PROGRAM): $(OBJECTS)
|
||||||
install -Dm 755 simpleswitcher $(BINDIR)/simpleswitcher
|
$(CC) -o $@ $^ $(LDADD) $(LDFLAGS)
|
||||||
|
|
||||||
|
install: $(BUILD_DIR)/$(PROGRAM) install-man
|
||||||
|
install -Dm 755 $(BUILD_DIR)/$(PROGRAM) $(BINDIR)/$(PROGRAM)
|
||||||
|
|
||||||
install-man:
|
install-man:
|
||||||
install -Dm 644 simpleswitcher.1 $(MANDIR)/simpleswitcher.1
|
install -Dm 644 $(DOC_DIR)/simpleswitcher.1 $(MANDIR)/simpleswitcher.1
|
||||||
gzip -f $(MANDIR)/simpleswitcher.1
|
gzip -f $(MANDIR)/simpleswitcher.1
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f simpleswitcher $(OBJECTS)
|
rm -rf $(BUILD_DIR)
|
||||||
|
|
||||||
|
|
||||||
indent:
|
indent:
|
||||||
@astyle --style=linux -S -C -D -N -H -L -W3 -f simpleswitcher.c textbox.c
|
@astyle --style=linux -S -C -D -N -H -L -W3 -f $(SOURCES) $(HEADERS)
|
||||||
|
|
|
@ -28,10 +28,10 @@ typedef enum {
|
||||||
|
|
||||||
|
|
||||||
textbox* textbox_create( Window parent,
|
textbox* textbox_create( Window parent,
|
||||||
TextboxFlags flags,
|
TextboxFlags flags,
|
||||||
short x, short y, short w, short h,
|
short x, short y, short w, short h,
|
||||||
char *font, char *fg, char *bg,
|
char *font, char *fg, char *bg,
|
||||||
char *text, char *prompt );
|
char *text, char *prompt );
|
||||||
|
|
||||||
void textbox_free( textbox *tb );
|
void textbox_free( textbox *tb );
|
||||||
|
|
|
@ -49,10 +49,10 @@ void textbox_moveresize( textbox *tb, int x, int y, int w, int h );
|
||||||
|
|
||||||
// Xft text box, optionally editable
|
// Xft text box, optionally editable
|
||||||
textbox* textbox_create( Window parent,
|
textbox* textbox_create( Window parent,
|
||||||
TextboxFlags flags,
|
TextboxFlags flags,
|
||||||
short x, short y, short w, short h,
|
short x, short y, short w, short h,
|
||||||
char *font, char *fg, char *bg,
|
char *font, char *fg, char *bg,
|
||||||
char *text, char *prompt )
|
char *text, char *prompt )
|
||||||
{
|
{
|
||||||
textbox *tb = calloc( 1, sizeof( textbox ) );
|
textbox *tb = calloc( 1, sizeof( textbox ) );
|
||||||
|
|
Loading…
Reference in a new issue