mirror of
https://github.com/tmate-io/tmate.git
synced 2024-11-23 08:33:17 +01:00
Apply the make magic wand to pick an osdep-*.c file rather than using ifdefs.
This commit is contained in:
parent
ce989a91d1
commit
91241f1457
10
GNUmakefile
10
GNUmakefile
@ -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
|
.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-clock.c window-scroll.c window-more.c window-copy.c \
|
||||||
window-choose.c \
|
window-choose.c \
|
||||||
options.c options-cmd.c paste.c colour.c utf8.c clock.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 \
|
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 attributes.c
|
|
||||||
|
|
||||||
CC?= gcc
|
CC?= gcc
|
||||||
INCDIRS+= -I. -I-
|
INCDIRS+= -I. -I-
|
||||||
@ -120,6 +118,10 @@ CFLAGS+= $(shell getconf LFS_CFLAGS) -D_GNU_SOURCE \
|
|||||||
LIBS+= -lcrypt -lutil
|
LIBS+= -lcrypt -lutil
|
||||||
endif
|
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))
|
OBJS= $(patsubst %.c,%.o,$(SRCS))
|
||||||
|
|
||||||
CLEANFILES= ${PROG} *.o .depend *~ ${PROG}.core *.log compat/*.o index.html
|
CLEANFILES= ${PROG} *.o .depend *~ ${PROG}.core *.log compat/*.o index.html
|
||||||
|
9
Makefile
9
Makefile
@ -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
|
.SUFFIXES: .c .o .y .h
|
||||||
.PHONY: clean update-index.html upload-index.html
|
.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-clock.c window-scroll.c window-more.c window-copy.c \
|
||||||
window-choose.c \
|
window-choose.c \
|
||||||
options.c options-cmd.c paste.c colour.c utf8.c clock.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 \
|
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
|
|
||||||
|
|
||||||
CC?= c
|
CC?= c
|
||||||
INCDIRS+= -I. -I- -I/usr/local/include
|
INCDIRS+= -I. -I- -I/usr/local/include
|
||||||
@ -96,6 +94,9 @@ LIBS+= -lcrypt
|
|||||||
CFLAGS+=-DNO_STRTONUM -DNO_QUEUE_H
|
CFLAGS+=-DNO_STRTONUM -DNO_QUEUE_H
|
||||||
.endif
|
.endif
|
||||||
|
|
||||||
|
OSDEP!= [ -f osdep-${OS:L}.c ] && echo ${OS:L} || echo unknown
|
||||||
|
SRCS+= osdep-${OSDEP}.c
|
||||||
|
|
||||||
OBJS= ${SRCS:S/.c/.o/:S/.y/.o/}
|
OBJS= ${SRCS:S/.c/.o/:S/.y/.o/}
|
||||||
|
|
||||||
DISTDIR= ${PROG}-${VERSION}
|
DISTDIR= ${PROG}-${VERSION}
|
||||||
|
@ -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>
|
* 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.
|
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef __APPLE__
|
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/sysctl.h>
|
#include <sys/sysctl.h>
|
||||||
|
|
||||||
@ -47,5 +45,3 @@ osdep_get_name(int fd, unused char *tty)
|
|||||||
|
|
||||||
return (strdup(kp.kp_proc.p_comm));
|
return (strdup(kp.kp_proc.p_comm));
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
|
||||||
|
@ -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>
|
* 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.
|
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef __FreeBSD__
|
|
||||||
|
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
#include <sys/proc.h>
|
#include <sys/proc.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
@ -121,5 +119,3 @@ retry:
|
|||||||
free(buf);
|
free(buf);
|
||||||
return (name);
|
return (name);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
|
||||||
|
@ -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>
|
* 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.
|
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef __linux__
|
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
|
||||||
@ -59,5 +57,3 @@ osdep_get_name(int fd, unused char *tty)
|
|||||||
fclose(f);
|
fclose(f);
|
||||||
return (buf);
|
return (buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
|
||||||
|
@ -14,8 +14,6 @@
|
|||||||
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef __NetBSD__
|
|
||||||
|
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
#include <sys/proc.h>
|
#include <sys/proc.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
@ -118,5 +116,3 @@ retry:
|
|||||||
free(buf);
|
free(buf);
|
||||||
return (name);
|
return (name);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
|
||||||
|
@ -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>
|
* 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.
|
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef __OpenBSD__
|
|
||||||
|
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
#include <sys/sysctl.h>
|
#include <sys/sysctl.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
@ -130,5 +128,3 @@ retry:
|
|||||||
free(buf);
|
free(buf);
|
||||||
return (name);
|
return (name);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
|
||||||
|
@ -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>
|
* 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.
|
* 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 <sys/types.h>
|
||||||
|
|
||||||
#include "tmux.h"
|
#include "tmux.h"
|
||||||
@ -28,5 +25,3 @@ osdep_get_name(unused int fd, unused char *tty)
|
|||||||
{
|
{
|
||||||
return (NULL);
|
return (NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
|
||||||
|
Loading…
Reference in New Issue
Block a user