# DWM help.



## shix (May 12, 2012)

Hello, first of all I'd like to say I'm new to this forum and FreeBSD. (Sorry if I have posted in the wrong section)

Alright, my problem is installing DWM by downloading it from its website (Don't want to install from ports). When I 
ran `make install` I noticed I had to configure my config.mk and Makefile. I've tried configuring those t*w*o files with no luck... Can any one please help?

Makefile:

```
# dwm - dynamic window manager
# See LICENSE file for copyright and license details.

include config.mk

SRC = dwm.c
OBJ = ${SRC:.c=.o}
USE_XORG+=	xinerama
OPTIONS=        XINERAMA        "Enable Xinerama support" On


all: options dwm

options:
	@echo dwm build options:
	@echo "CFLAGS   = ${CFLAGS}"
	@echo "LDFLAGS  = ${LDFLAGS}"
	@echo "CC       = ${CC}"

.c.o:
	@echo CC $<
	@${CC} -c ${CFLAGS} $<

${OBJ}: config.h config.mk

config.h:
	@echo creating $@ from config.def.h
	@cp config.def.h $@

dwm: ${OBJ}
	@echo CC -o $@
	@${CC} -o $@ ${OBJ} ${LDFLAGS}

clean:
	@echo cleaning
	@rm -f dwm ${OBJ} dwm-${VERSION}.tar.gz

dist: clean
	@echo creating dist tarball
	@mkdir -p dwm-${VERSION}
	@cp -R LICENSE Makefile README config.def.h config.mk \
		dwm.1 ${SRC} dwm-${VERSION}
	@tar -cf dwm-${VERSION}.tar dwm-${VERSION}
	@gzip dwm-${VERSION}.tar
	@rm -rf dwm-${VERSION}

install: all
	@echo installing executable file to ${DESTDIR}${PREFIX}/bin
	@mkdir -p ${DESTDIR}${PREFIX}/bin
	@cp -f dwm ${DESTDIR}${PREFIX}/bin
	@chmod 755 ${DESTDIR}${PREFIX}/bin/dwm
	@echo installing manual page to ${DESTDIR}${MANPREFIX}/man/man1
	@mkdir -p ${DESTDIR}${MANPREFIX}/man/man1
	@sed "s/VERSION/${VERSION}/g" < dwm.1 > ${DESTDIR}${MANPREFIX}/man/man1/dwm.1
	@chmod 644 ${DESTDIR}${MANPREFIX}/man/man1/dwm.1
	

uninstall:
	@echo removing executable file from ${DESTDIR}${PREFIX}/bin
	@rm -f ${DESTDIR}${PREFIX}/bin/dwm
	@echo removing manual page from ${DESTDIR}${MANPREFIX}/man/man1
	@rm -f ${DESTDIR}${MANPREFIX}/man/man1/dwm.

.PHONY: all options clean dist install uninstall
```

config.mk:

```
# dwm version
VERSION = 6.0

# Customize below to fit your system

# paths
PREFIX = /usr/local
MANPREFIX = ${PREFIX}/share/man

X11INC = /usr/include
X11LIB = /usr/lib

# Xinerama
XINERAMALIBS = -L${X11LIB} -lXinerama
XINERAMAFLAGS = -DXINERAMA

# includes and libs
INCS = -I. -I/usr/include -I${X11INC}
LIBS = -L/usr/lib -lc -L${X11LIB} -lX11 ${XINERAMALIBS}

# flags
CPPFLAGS = -DVERSION=\"${VERSION}\" ${XINERAMAFLAGS}
#CFLAGS = -g -std=c99 -pedantic -Wall -O0 ${INCS} ${CPPFLAGS}
CFLAGS   = -O2 -pipe -fno-strict-aliasing  -std=c99 -I. -I/usr/include -I/usr/local/include  -DVERSION="6.0" -DXINERAMA
#LDFLAGS = -g ${LIBS}
LDFLAGS  =  -L/usr/lib -lc -L/usr/local/lib -lX11 -L/usr/local/lib -lXinerama


# Solaris
#CFLAGS = -fast ${INCS} -DVERSION=\"${VERSION}\"
#LDFLAGS = ${LIBS}

# compiler and linker
CC = cc
```

Error I keep getting:

```
CFLAGS   = -O2 -pipe -fno-strict-aliasing  -std=c99 -I. -I/usr/include -I/usr/local/include  -DVERSION=6.0 -DXINERAMA
LDFLAGS  = -L/usr/lib -lc -L/usr/local/lib -lX11 -L/usr/local/lib -lXinerama
CC       = cc
CC dwm.c
dwm.c: In function 'updatestatus':
dwm.c:2009: error: expected ')' before numeric constant
dwm.c: In function 'main':
dwm.c:2132: error: expected ')' before numeric constant
*** Error code 1

Stop in /usr/home/shixhaxermod98/Downloads/dwm-6.0.
```

Thank you for your time.


----------



## DutchDaemon (May 12, 2012)

Read your signup email about the forum formatting rules.

And why not use ports (which is compiling from source) when you're going to compile from source anyway? Ports are sources specifically patched for FreeBSD. So you're only setting yourself up for trouble.

Moreover: installing third-party applications _outside_ of the ports and packages framework is not something we will happily support on these forums. We have limited time and resources, and a lot of those go into creating working ports to avoid the problems you're running into ..


----------



## shix (May 12, 2012)

Well, I'd like to edit, dwm.c and what not. I was thinking about adding something like this to the makefile in the port.


```
.if defined(DWM_C)
         @${ECHO_MSG} "creating dwm.c from ${DWM_C}"
         @${CP} ${DWM_C} ${WRKSRC}/dwm.c
.endif
```

However I'm not sure.


----------

