-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add or fix support for building on Solaris, illumos, Linux/musl, NetBSD, OpenBSD, IBM AIX, and Haiku. * Use pkg-config when available to determine CFLAGS and libraries. * Cleanup Makefile. * Cleanup excess trailing whitespace characters. * Indent nested preprocessor directives with GNU Cppi. * Tested build under Oracle Solaris, OpenIndiana illumos, Linux/musl, Linux/glibc, IBM AIX, Haiku, FreeBSD, OpenBSD, NetBSD, and Apple macOS. * Compilation tested and working with PCC, GCC, Clang, IBM XL C, IBM Open XL C, Oracle Studio C, NVIDIA HPC SDK C, Portland Group C, and DMD ImportC. Signed-off-by: Jeffrey H. Johnson <trnsz@pobox.com>
- Loading branch information
Showing
9 changed files
with
263 additions
and
193 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
# Makefile for the supdup server and client. | ||
|
||
SHELL = /bin/sh | ||
PREFIX ?= /usr/local | ||
|
||
CC ?= cc | ||
RM ?= rm -f | ||
|
||
OS_NAME ?= $(shell uname 2> /dev/null) | ||
CFLAGS += $(shell pkg-config --cflags ncurses 2> /dev/null) | ||
NCURSES_LIBS ?= $(shell pkg-config --libs ncurses 2> /dev/null || printf '%s' "-lncurses") | ||
|
||
# AIX (needs linking libcurses *after* libncurses) | ||
ifeq ($(OS_NAME), AIX) | ||
EXTRA_LDFLAGS = -lcurses | ||
endif | ||
|
||
# Mac OS X | ||
ifeq ($(OS_NAME), Darwin) | ||
LDFLAGS += -L/opt/local/lib | ||
endif | ||
|
||
# Solaris and illumos | ||
ifeq ($(OS_NAME), SunOS) | ||
CFLAGS += -I/usr/include/ncurses | ||
EXTRA_LDFLAGS = -lnsl -lsocket | ||
endif | ||
|
||
# Haiku | ||
ifeq ($(OS_NAME), Haiku) | ||
EXTRA_LDFLAGS = -lnetwork | ||
endif | ||
|
||
# NetBSD | ||
ifeq ($(OS_NAME), NetBSD) | ||
CFLAGS += -I/usr/pkg/include -I/usr/pkg/include/ncurses | ||
LDFLAGS += -L/usr/pkg/lib | ||
endif | ||
|
||
# The server (supdupd) isn't ready for prime time. | ||
.PHONY: all | ||
all: supdup | ||
|
||
SUPDUP_OBJS = supdup.o charmap.o tcp.o chaos.o | ||
supdup: $(SUPDUP_OBJS) | ||
$(CC) $(LDFLAGS) -o $@ $(SUPDUP_OBJS) $(NCURSES_LIBS) $(EXTRA_LDFLAGS) | ||
|
||
SUPDUPD_OBJS = supdupd.o | ||
supdupd: $(SUPDUPD_OBJS) | ||
$(CC) $(LDFLAGS) -o $@ $(SUPDUPD_OBJS) | ||
|
||
.PHONY: install | ||
install: supdup | ||
install -m 0755 supdup $(PREFIX)/bin | ||
test -x supdupd && install -m 0755 supdupd $(PREFIX)/bin | ||
|
||
.PHONY: clean | ||
clean: | ||
$(RM) *.o | ||
$(RM) supdup supdupd | ||
|
||
.PHONY: distclean | ||
distclean: clean | ||
$(RM) *~ *.bak core *.core | ||
|
||
# Dependencies | ||
chaos.o: supdup.h | ||
charmap.o: charmap.h | ||
supdup.o: charmap.h | ||
supdupd.o: supdup.h | ||
tcp.o: supdup.h |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
#ifndef CHARMAP_H | ||
#define CHARMAP_H | ||
#if !defined(CHARMAP_H) | ||
# define CHARMAP_H | ||
|
||
typedef struct { | ||
char *name; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.