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
|
||||
# See LICENSE file for copyright and license details.
|
||||
|
||||
include config.mk
|
||||
-include config.mk
|
||||
|
||||
SRC = drw.c dwm.c util.c
|
||||
OBJ = ${SRC:.c=.o}
|
||||
VERSION = 6.7
|
||||
|
||||
all: dwm
|
||||
INSTALL ?= install
|
||||
GZIP ?= gzip
|
||||
TAR ?= tar
|
||||
|
||||
.c.o:
|
||||
${CC} -c ${CFLAGS} $<
|
||||
CFLAGS := -Os $(CFLAGS) -g -std=gnu99\
|
||||
-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:
|
||||
cp config.def.h $@
|
||||
SRC := $(wildcard src/*.c)
|
||||
OBJ := $(addsuffix .o,$(SRC))
|
||||
DEP := $(addsuffix .d,$(SRC))
|
||||
|
||||
dwm: ${OBJ}
|
||||
${CC} -o $@ ${OBJ} ${LDFLAGS}
|
||||
# Set Q to @ to silence commands being printed, unless --no-silent has been set
|
||||
ifeq (0, $(words $(findstring --no-silent,$(MAKEFLAGS))))
|
||||
Q=@
|
||||
endif
|
||||
|
||||
clean:
|
||||
rm -f dwm ${OBJ} dwm-${VERSION}.tar.gz
|
||||
msg = @printf '%-8s %s\n' "$(1)" "$(2)"
|
||||
|
||||
dist: clean
|
||||
mkdir -p dwm-${VERSION}
|
||||
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}
|
||||
.PHONY:
|
||||
all: bin/dwm
|
||||
|
||||
install: all
|
||||
mkdir -p ${DESTDIR}${PREFIX}/bin
|
||||
cp -f dwm ${DESTDIR}${PREFIX}/bin
|
||||
chmod 755 ${DESTDIR}${PREFIX}/bin/dwm
|
||||
mkdir -p ${DESTDIR}${MANPREFIX}/man1
|
||||
sed "s/VERSION/${VERSION}/g" < dwm.1 > ${DESTDIR}${MANPREFIX}/man1/dwm.1
|
||||
chmod 644 ${DESTDIR}${MANPREFIX}/man1/dwm.1
|
||||
.PHONY:
|
||||
install: $(DESTDIR)/bin/dwm $(DESTDIR)/share/man/man1/dwm.1.gz
|
||||
$(DESTDIR)/bin/%: bin/%
|
||||
$(call msg,INSTALL,$@)
|
||||
$(Q)$(INSTALL) -D -m0755 $< $@
|
||||
|
||||
$(DESTDIR)/share/man/%: man/%
|
||||
$(call msg,INSTALL,$@)
|
||||
$(Q)$(INSTALL) -D -m0644 $< $@
|
||||
|
||||
.PHONY:
|
||||
uninstall:
|
||||
rm -f ${DESTDIR}${PREFIX}/bin/dwm\
|
||||
${DESTDIR}${MANPREFIX}/man1/dwm.1
|
||||
$(Q)$(RM) $(DESTDIR)/bin/dwm\
|
||||
$(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)
|
||||
{
|
||||
int di;
|
||||
unsigned long dl;
|
||||
unsigned long nitems, dl;
|
||||
unsigned char *p = NULL;
|
||||
Atom da, atom = None;
|
||||
|
||||
if (XGetWindowProperty(dpy, c->win, prop, 0L, sizeof atom, False, XA_ATOM,
|
||||
&da, &di, &dl, &dl, &p) == Success && p) {
|
||||
if (dl > 0)
|
||||
&da, &di, &nitems, &dl, &p) == Success && p) {
|
||||
if (nitems > 0)
|
||||
atom = *(Atom *)p;
|
||||
XFree(p);
|
||||
}
|
||||
@@ -5,6 +5,7 @@
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/Xutil.h>
|
||||
|
||||
/*
|
||||
int main(void) {
|
||||
Display *d;
|
||||
Window r, f, t = None;
|
||||
@@ -40,3 +41,4 @@ int main(void) {
|
||||
XCloseDisplay(d);
|
||||
exit(0);
|
||||
}
|
||||
*/
|
||||
Reference in New Issue
Block a user