Compare commits
9 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 1bae806fe5 | |||
| 2f76a5cc49 | |||
| ab2253a0ee | |||
| c23f9dfe2e | |||
| eda3495acf | |||
| 1448916be3 | |||
| f12825443e | |||
| c750f87edd | |||
|
|
a9aa0d8ffb |
20
.gitignore
vendored
Normal file
20
.gitignore
vendored
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
# Ignore dotfiles by default
|
||||||
|
.*
|
||||||
|
|
||||||
|
# Ignore common (generated) file types
|
||||||
|
*.a
|
||||||
|
*.o
|
||||||
|
*.d
|
||||||
|
*.so
|
||||||
|
*.out
|
||||||
|
*.hex
|
||||||
|
*.gz
|
||||||
|
|
||||||
|
# Ignore specific project files
|
||||||
|
compile_commands.json
|
||||||
|
/bin/
|
||||||
|
/config.mk
|
||||||
|
|
||||||
|
# Unignore specific files.
|
||||||
|
!.gitignore
|
||||||
|
!.clang-format
|
||||||
107
Makefile
107
Makefile
@@ -1,45 +1,92 @@
|
|||||||
# dwm - dynamic window manager
|
# dwm - dynamic window manager
|
||||||
# See LICENSE file for copyright and license details.
|
# See LICENSE file for copyright and license details.
|
||||||
|
|
||||||
include config.mk
|
-include config.mk
|
||||||
|
|
||||||
SRC = drw.c dwm.c util.c
|
VERSION = 6.7
|
||||||
OBJ = ${SRC:.c=.o}
|
|
||||||
|
|
||||||
all: dwm
|
INSTALL ?= install
|
||||||
|
GZIP ?= gzip
|
||||||
|
TAR ?= tar
|
||||||
|
|
||||||
.c.o:
|
CFLAGS := -Os $(CFLAGS) -g -std=gnu99\
|
||||||
${CC} -c ${CFLAGS} $<
|
-Wall -Wextra -Wpedantic -Wno-pointer-arith
|
||||||
|
CPPFLAGS := -DNDEBUG $(CPPFLAGS)\
|
||||||
|
-DVERSION=\"$(VERSION)\" -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=700L -DXINERAMA
|
||||||
|
LDFLAGS := -flto $(LDFLAGS)
|
||||||
|
LDLIBS := $(LDLIBS) -lm
|
||||||
|
|
||||||
${OBJ}: config.h config.mk
|
# Use pkg-config to locate dependencies, and set the correct flags.
|
||||||
|
ifeq (,$(shell command -v pkg-config))
|
||||||
|
$(error Failed to locate pkg-config, please make sure it is installed or acessible through PATH.)
|
||||||
|
else
|
||||||
|
CPPFLAGS += $(shell pkg-config --cflags-only-I fontconfig freetype2 x11 xft xinerama)
|
||||||
|
LDFLAGS += $(shell pkg-config --libs-only-L fontconfig freetype2 x11 xft xinerama)
|
||||||
|
LDLIBS += $(shell pkg-config --libs-only-l fontconfig freetype2 x11 xft xinerama)
|
||||||
|
endif
|
||||||
|
|
||||||
config.h:
|
SRC := $(wildcard src/*.c)
|
||||||
cp config.def.h $@
|
OBJ := $(addsuffix .o,$(SRC))
|
||||||
|
DEP := $(addsuffix .d,$(SRC))
|
||||||
|
|
||||||
dwm: ${OBJ}
|
# Set Q to @ to silence commands being printed, unless --no-silent has been set
|
||||||
${CC} -o $@ ${OBJ} ${LDFLAGS}
|
ifeq (0, $(words $(findstring --no-silent,$(MAKEFLAGS))))
|
||||||
|
Q=@
|
||||||
|
endif
|
||||||
|
|
||||||
clean:
|
msg = @printf '%-8s %s\n' "$(1)" "$(2)"
|
||||||
rm -f dwm ${OBJ} dwm-${VERSION}.tar.gz
|
|
||||||
|
|
||||||
dist: clean
|
.PHONY:
|
||||||
mkdir -p dwm-${VERSION}
|
all: bin/dwm
|
||||||
cp -R LICENSE Makefile README config.def.h config.mk\
|
|
||||||
dwm.1 drw.h util.h ${SRC} dwm.png transient.c dwm-${VERSION}
|
|
||||||
tar -cf dwm-${VERSION}.tar dwm-${VERSION}
|
|
||||||
gzip dwm-${VERSION}.tar
|
|
||||||
rm -rf dwm-${VERSION}
|
|
||||||
|
|
||||||
install: all
|
.PHONY:
|
||||||
mkdir -p ${DESTDIR}${PREFIX}/bin
|
install: $(DESTDIR)/bin/dwm $(DESTDIR)/share/man/man1/dwm.1.gz
|
||||||
cp -f dwm ${DESTDIR}${PREFIX}/bin
|
$(DESTDIR)/bin/%: bin/%
|
||||||
chmod 755 ${DESTDIR}${PREFIX}/bin/dwm
|
$(call msg,INSTALL,$@)
|
||||||
mkdir -p ${DESTDIR}${MANPREFIX}/man1
|
$(Q)$(INSTALL) -D -m0755 $< $@
|
||||||
sed "s/VERSION/${VERSION}/g" < dwm.1 > ${DESTDIR}${MANPREFIX}/man1/dwm.1
|
|
||||||
chmod 644 ${DESTDIR}${MANPREFIX}/man1/dwm.1
|
|
||||||
|
|
||||||
|
$(DESTDIR)/share/man/%: man/%
|
||||||
|
$(call msg,INSTALL,$@)
|
||||||
|
$(Q)$(INSTALL) -D -m0644 $< $@
|
||||||
|
|
||||||
|
.PHONY:
|
||||||
uninstall:
|
uninstall:
|
||||||
rm -f ${DESTDIR}${PREFIX}/bin/dwm\
|
$(Q)$(RM) $(DESTDIR)/bin/dwm\
|
||||||
${DESTDIR}${MANPREFIX}/man1/dwm.1
|
$(DESTDIR)/share/man/man1/dwm.1.gz
|
||||||
|
|
||||||
.PHONY: all clean dist install uninstall
|
.PHONY:
|
||||||
|
clean:
|
||||||
|
$(call msg,CLEAN,src/)
|
||||||
|
$(Q)$(RM) $(OBJ)
|
||||||
|
$(call msg,CLEAN,man/)
|
||||||
|
$(Q)$(RM) $(MAN)
|
||||||
|
$(call msg,CLEAN,bin/)
|
||||||
|
$(Q)$(RM) -r bin/
|
||||||
|
|
||||||
|
# Links together the object files into the final binary.
|
||||||
|
bin/dwm: $(OBJ) | bin/
|
||||||
|
$(call msg,LD,$@)
|
||||||
|
$(Q)$(CC) $(LDFLAGS) $(LDLIBS) -o $@ $^
|
||||||
|
|
||||||
|
# Compiles C sources into Object files
|
||||||
|
%.c.o: %.c
|
||||||
|
$(call msg,CC,$@)
|
||||||
|
$(Q)$(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $<
|
||||||
|
|
||||||
|
# Compress files requested for compression using GZIP
|
||||||
|
%.gz: %
|
||||||
|
$(call msg,GZIP,$@)
|
||||||
|
$(Q)$(GZIP) -k $<
|
||||||
|
|
||||||
|
# Create directories
|
||||||
|
%/:
|
||||||
|
$(call msg-mkdir,$@)
|
||||||
|
$(Q)mkdir $@
|
||||||
|
|
||||||
|
# Generate and include dependencies,
|
||||||
|
# ignoring any errors that may occur when doing so.
|
||||||
|
%.c.d: %.c
|
||||||
|
$(Q)$(CC) -MM $(CPPFLAGS) -MF $@ $<
|
||||||
|
ifeq (0, $(words $(findstring $(MAKECMDGOALS), clean)))
|
||||||
|
-include $(DEP)
|
||||||
|
endif
|
||||||
|
|||||||
39
config.mk
39
config.mk
@@ -1,39 +0,0 @@
|
|||||||
# dwm version
|
|
||||||
VERSION = 6.7
|
|
||||||
|
|
||||||
# Customize below to fit your system
|
|
||||||
|
|
||||||
# paths
|
|
||||||
PREFIX = /usr/local
|
|
||||||
MANPREFIX = ${PREFIX}/share/man
|
|
||||||
|
|
||||||
X11INC = /usr/X11R6/include
|
|
||||||
X11LIB = /usr/X11R6/lib
|
|
||||||
|
|
||||||
# Xinerama, comment if you don't want it
|
|
||||||
XINERAMALIBS = -lXinerama
|
|
||||||
XINERAMAFLAGS = -DXINERAMA
|
|
||||||
|
|
||||||
# freetype
|
|
||||||
FREETYPELIBS = -lfontconfig -lXft
|
|
||||||
FREETYPEINC = /usr/include/freetype2
|
|
||||||
# OpenBSD (uncomment)
|
|
||||||
#FREETYPEINC = ${X11INC}/freetype2
|
|
||||||
#MANPREFIX = ${PREFIX}/man
|
|
||||||
|
|
||||||
# includes and libs
|
|
||||||
INCS = -I${X11INC} -I${FREETYPEINC}
|
|
||||||
LIBS = -L${X11LIB} -lX11 ${XINERAMALIBS} ${FREETYPELIBS}
|
|
||||||
|
|
||||||
# flags
|
|
||||||
CPPFLAGS = -D_DEFAULT_SOURCE -D_BSD_SOURCE -D_XOPEN_SOURCE=700L -DVERSION=\"${VERSION}\" ${XINERAMAFLAGS}
|
|
||||||
#CFLAGS = -g -std=c99 -pedantic -Wall -O0 ${INCS} ${CPPFLAGS}
|
|
||||||
CFLAGS = -std=c99 -pedantic -Wall -Wno-deprecated-declarations -Os ${INCS} ${CPPFLAGS}
|
|
||||||
LDFLAGS = ${LIBS}
|
|
||||||
|
|
||||||
# Solaris
|
|
||||||
#CFLAGS = -fast ${INCS} -DVERSION=\"${VERSION}\"
|
|
||||||
#LDFLAGS = ${LIBS}
|
|
||||||
|
|
||||||
# compiler and linker
|
|
||||||
CC = cc
|
|
||||||
@@ -864,13 +864,13 @@ Atom
|
|||||||
getatomprop(Client *c, Atom prop)
|
getatomprop(Client *c, Atom prop)
|
||||||
{
|
{
|
||||||
int di;
|
int di;
|
||||||
unsigned long dl;
|
unsigned long nitems, dl;
|
||||||
unsigned char *p = NULL;
|
unsigned char *p = NULL;
|
||||||
Atom da, atom = None;
|
Atom da, atom = None;
|
||||||
|
|
||||||
if (XGetWindowProperty(dpy, c->win, prop, 0L, sizeof atom, False, XA_ATOM,
|
if (XGetWindowProperty(dpy, c->win, prop, 0L, sizeof atom, False, XA_ATOM,
|
||||||
&da, &di, &dl, &dl, &p) == Success && p) {
|
&da, &di, &nitems, &dl, &p) == Success && p) {
|
||||||
if (dl > 0)
|
if (nitems > 0)
|
||||||
atom = *(Atom *)p;
|
atom = *(Atom *)p;
|
||||||
XFree(p);
|
XFree(p);
|
||||||
}
|
}
|
||||||
@@ -5,6 +5,7 @@
|
|||||||
#include <X11/Xlib.h>
|
#include <X11/Xlib.h>
|
||||||
#include <X11/Xutil.h>
|
#include <X11/Xutil.h>
|
||||||
|
|
||||||
|
/*
|
||||||
int main(void) {
|
int main(void) {
|
||||||
Display *d;
|
Display *d;
|
||||||
Window r, f, t = None;
|
Window r, f, t = None;
|
||||||
@@ -40,3 +41,4 @@ int main(void) {
|
|||||||
XCloseDisplay(d);
|
XCloseDisplay(d);
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
Reference in New Issue
Block a user