Apply the make magic wand to pick an osdep-*.c file rather than using ifdefs.

This commit is contained in:
Nicholas Marriott 2009-04-29 23:07:35 +00:00
parent ce989a91d1
commit 91241f1457
8 changed files with 16 additions and 38 deletions

View File

@ -1,4 +1,4 @@
# $Id: GNUmakefile,v 1.88 2009-04-29 22:42:02 nicm Exp $
# $Id: GNUmakefile,v 1.89 2009-04-29 23:07:35 nicm Exp $
.PHONY: clean
@ -42,9 +42,7 @@ SRCS= tmux.c server.c server-msg.c server-fn.c buffer.c buffer-poll.c status.c \
window-clock.c window-scroll.c window-more.c window-copy.c \
window-choose.c \
options.c options-cmd.c paste.c colour.c utf8.c clock.c \
tty.c tty-term.c tty-keys.c tty-write.c util.c names.c \
osdep-unknown.c osdep-openbsd.c osdep-freebsd.c osdep-linux.c \
osdep-darwin.c attributes.c
tty.c tty-term.c tty-keys.c tty-write.c util.c names.c attributes.c
CC?= gcc
INCDIRS+= -I. -I-
@ -120,6 +118,10 @@ CFLAGS+= $(shell getconf LFS_CFLAGS) -D_GNU_SOURCE \
LIBS+= -lcrypt -lutil
endif
LCOS= $(shell uname|tr '[:upper:]' '[:lower:]')
OSDEP= $(shell [ -f osdep-$(LCOS).c ] && echo $(LCOS) || echo unknown)
SRCS+= osdep-$(OSDEP).c
OBJS= $(patsubst %.c,%.o,$(SRCS))
CLEANFILES= ${PROG} *.o .depend *~ ${PROG}.core *.log compat/*.o index.html

View File

@ -1,4 +1,4 @@
# $Id: Makefile,v 1.126 2009-04-29 22:25:20 nicm Exp $
# $Id: Makefile,v 1.127 2009-04-29 23:07:35 nicm Exp $
.SUFFIXES: .c .o .y .h
.PHONY: clean update-index.html upload-index.html
@ -45,9 +45,7 @@ SRCS= tmux.c server.c server-msg.c server-fn.c buffer.c buffer-poll.c status.c \
window-clock.c window-scroll.c window-more.c window-copy.c \
window-choose.c \
options.c options-cmd.c paste.c colour.c utf8.c clock.c \
tty.c tty-term.c tty-keys.c tty-write.c util.c names.c attributes.c \
osdep-unknown.c osdep-openbsd.c osdep-freebsd.c osdep-linux.c \
osdep-darwin.c osdep-netbsd.c
tty.c tty-term.c tty-keys.c tty-write.c util.c names.c attributes.c
CC?= c
INCDIRS+= -I. -I- -I/usr/local/include
@ -96,6 +94,9 @@ LIBS+= -lcrypt
CFLAGS+=-DNO_STRTONUM -DNO_QUEUE_H
.endif
OSDEP!= [ -f osdep-${OS:L}.c ] && echo ${OS:L} || echo unknown
SRCS+= osdep-${OSDEP}.c
OBJS= ${SRCS:S/.c/.o/:S/.y/.o/}
DISTDIR= ${PROG}-${VERSION}

View File

@ -1,4 +1,4 @@
/* $Id: osdep-darwin.c,v 1.9 2009-02-13 00:43:04 nicm Exp $ */
/* $Id: osdep-darwin.c,v 1.10 2009-04-29 23:07:35 nicm Exp $ */
/*
* Copyright (c) 2009 Joshua Elsasser <josh@elsasser.org>
@ -16,8 +16,6 @@
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#ifdef __APPLE__
#include <sys/types.h>
#include <sys/sysctl.h>
@ -47,5 +45,3 @@ osdep_get_name(int fd, unused char *tty)
return (strdup(kp.kp_proc.p_comm));
}
#endif

View File

@ -1,4 +1,4 @@
/* $Id: osdep-freebsd.c,v 1.14 2009-02-13 00:43:04 nicm Exp $ */
/* $Id: osdep-freebsd.c,v 1.15 2009-04-29 23:07:35 nicm Exp $ */
/*
* Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net>
@ -16,8 +16,6 @@
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#ifdef __FreeBSD__
#include <sys/param.h>
#include <sys/proc.h>
#include <sys/stat.h>
@ -121,5 +119,3 @@ retry:
free(buf);
return (name);
}
#endif

View File

@ -1,4 +1,4 @@
/* $Id: osdep-linux.c,v 1.5 2009-02-13 00:43:04 nicm Exp $ */
/* $Id: osdep-linux.c,v 1.6 2009-04-29 23:07:35 nicm Exp $ */
/*
* Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net>
@ -16,8 +16,6 @@
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#ifdef __linux__
#include <sys/types.h>
#include <sys/stat.h>
@ -59,5 +57,3 @@ osdep_get_name(int fd, unused char *tty)
fclose(f);
return (buf);
}
#endif

View File

@ -14,8 +14,6 @@
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#ifdef __NetBSD__
#include <sys/param.h>
#include <sys/proc.h>
#include <sys/stat.h>
@ -118,5 +116,3 @@ retry:
free(buf);
return (name);
}
#endif

View File

@ -1,4 +1,4 @@
/* $Id: osdep-openbsd.c,v 1.14 2009-02-17 18:54:14 nicm Exp $ */
/* $Id: osdep-openbsd.c,v 1.15 2009-04-29 23:07:35 nicm Exp $ */
/*
* Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net>
@ -16,8 +16,6 @@
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#ifdef __OpenBSD__
#include <sys/param.h>
#include <sys/sysctl.h>
#include <sys/stat.h>
@ -130,5 +128,3 @@ retry:
free(buf);
return (name);
}
#endif

View File

@ -1,4 +1,4 @@
/* $Id: osdep-unknown.c,v 1.4 2009-03-31 21:22:10 nicm Exp $ */
/* $Id: osdep-unknown.c,v 1.5 2009-04-29 23:07:35 nicm Exp $ */
/*
* Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net>
@ -16,9 +16,6 @@
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#if !defined(__OpenBSD__) && !defined(__FreeBSD__) && !defined(__linux__) && \
!defined(__APPLE__) && !defined(__NetBSD__)
#include <sys/types.h>
#include "tmux.h"
@ -28,5 +25,3 @@ osdep_get_name(unused int fd, unused char *tty)
{
return (NULL);
}
#endif