2013-04-24 15:05:53 -04:00
|
|
|
CFILES=xcwd.c
|
|
|
|
CC=gcc
|
2013-07-01 17:09:33 -04:00
|
|
|
CFLAGS=-Wall -Werror -Wextra -std=gnu99 -O2
|
2013-04-24 15:05:53 -04:00
|
|
|
LDFLAGS=-lX11
|
|
|
|
EXE="xcwd"
|
|
|
|
prefix=/usr/
|
2013-07-01 17:09:33 -04:00
|
|
|
UNAME:=$(shell uname)
|
|
|
|
O=${CFILES:.c=.o}
|
|
|
|
|
|
|
|
ifeq ($(UNAME), Linux)
|
|
|
|
CFLAGS += -DLINUX
|
|
|
|
else
|
|
|
|
ifeq ($(UNAME), FreeBSD)
|
2013-07-01 20:41:20 -04:00
|
|
|
CFLAGS += -I/usr/local/include/ -DBSD
|
|
|
|
LDFLAGS += -L/usr/local/lib -lutil
|
2013-07-01 17:09:33 -04:00
|
|
|
else
|
|
|
|
$(error Operating System not supported.)
|
|
|
|
endif
|
|
|
|
endif
|
2013-04-24 15:05:53 -04:00
|
|
|
|
|
|
|
${EXE}: clean ${O}
|
2013-04-25 19:11:46 -04:00
|
|
|
${CC} -o $@ ${O} ${CFLAGS} ${LDFLAGS}
|
2013-04-24 15:05:53 -04:00
|
|
|
|
|
|
|
.SUFFIXES: .c .o
|
|
|
|
.c.o:
|
2013-04-25 12:00:41 -04:00
|
|
|
${CC} -c $< ${CFLAGS}
|
2013-04-24 15:05:53 -04:00
|
|
|
|
|
|
|
clean:
|
|
|
|
rm -vf *.o
|
|
|
|
|
|
|
|
distclean: clean
|
|
|
|
rm -vf ${EXE}
|
|
|
|
|
|
|
|
install: ${EXE}
|
|
|
|
install -m 0755 ${EXE} $(prefix)/bin
|
|
|
|
|