forked from I2P_Developers/i2p.i2p
FreeBSD port
This commit is contained in:
63
apps/sam/c/Makefile.freebsd
Normal file
63
apps/sam/c/Makefile.freebsd
Normal file
@@ -0,0 +1,63 @@
|
|||||||
|
#
|
||||||
|
# This Makefile is compatible with GNU Make (gmake) and should work on FreeBSD
|
||||||
|
#
|
||||||
|
|
||||||
|
#
|
||||||
|
# Your operating system
|
||||||
|
#
|
||||||
|
|
||||||
|
OS = FREEBSD
|
||||||
|
|
||||||
|
#
|
||||||
|
# Directories
|
||||||
|
#
|
||||||
|
|
||||||
|
INCDIR = inc
|
||||||
|
LIBDIR = lib
|
||||||
|
OBJDIR = obj
|
||||||
|
SRCDIR = src
|
||||||
|
|
||||||
|
#
|
||||||
|
# Programs
|
||||||
|
#
|
||||||
|
|
||||||
|
AR = ar
|
||||||
|
CC = gcc
|
||||||
|
|
||||||
|
#
|
||||||
|
# Flags
|
||||||
|
#
|
||||||
|
|
||||||
|
CFLAGS = -g -O2 -pipe -std=c99 -Wall
|
||||||
|
CFLAGS += -DOS=$(OS)
|
||||||
|
CFLAGS += -I$(INCDIR)
|
||||||
|
|
||||||
|
#
|
||||||
|
# Object files
|
||||||
|
#
|
||||||
|
|
||||||
|
OBJS = $(OBJDIR)/sam.o
|
||||||
|
|
||||||
|
#
|
||||||
|
# Build rules
|
||||||
|
#
|
||||||
|
|
||||||
|
all: depend libsam
|
||||||
|
|
||||||
|
depend:
|
||||||
|
$(CC) $(CFLAGS) -MM $(SRCDIR)/*.c > .depend
|
||||||
|
|
||||||
|
$(OBJDIR)/%.o: $(SRCDIR)/%.c
|
||||||
|
$(CC) $(CFLAGS) -o $@ -c $<
|
||||||
|
|
||||||
|
libsam: $(OBJS)
|
||||||
|
$(AR) rcs $(LIBDIR)/libsam.a $(OBJS)
|
||||||
|
|
||||||
|
#
|
||||||
|
# Cleanup rules
|
||||||
|
#
|
||||||
|
|
||||||
|
clean:
|
||||||
|
-rm -f $(LIBDIR)/libsam.a $(OBJDIR)/* .depend
|
||||||
|
|
||||||
|
tidy: clean
|
@@ -1,4 +1,5 @@
|
|||||||
v1.20
|
v1.20 2004-07-11
|
||||||
|
* Ported to FreeBSD (Makefile.freebsd)
|
||||||
* Full winsock compatibility - all Windows functions now return appropriate
|
* Full winsock compatibility - all Windows functions now return appropriate
|
||||||
error strings
|
error strings
|
||||||
|
|
||||||
|
@@ -34,7 +34,7 @@
|
|||||||
/*
|
/*
|
||||||
* Operating system
|
* Operating system
|
||||||
*/
|
*/
|
||||||
#define FREEBSD 0 // FreeBSD (untested)
|
#define FREEBSD 0 // FreeBSD
|
||||||
#define MINGW 1 // Windows native (Mingw)
|
#define MINGW 1 // Windows native (Mingw)
|
||||||
#define LINUX 2 // Linux
|
#define LINUX 2 // Linux
|
||||||
#define CYGWIN 3 // Cygwin
|
#define CYGWIN 3 // Cygwin
|
||||||
@@ -83,9 +83,10 @@
|
|||||||
#include <winsock.h>
|
#include <winsock.h>
|
||||||
#else
|
#else
|
||||||
#include <arpa/inet.h>
|
#include <arpa/inet.h>
|
||||||
|
#include <netinet/in.h>
|
||||||
#include <sys/select.h>
|
#include <sys/select.h>
|
||||||
#include <sys/types.h>
|
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
|
#include <sys/types.h>
|
||||||
#endif
|
#endif
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
@@ -189,7 +189,7 @@ samerr_t sam_dgram_send(const sam_pubkey_t dest, const void *data, size_t size)
|
|||||||
#ifdef NO_Z_FORMAT
|
#ifdef NO_Z_FORMAT
|
||||||
SAMLOG("Invalid data send size (%u bytes)", size);
|
SAMLOG("Invalid data send size (%u bytes)", size);
|
||||||
#else
|
#else
|
||||||
SAMLOG("Invalid data send size (%z bytes)", size);
|
SAMLOG("Invalid data send size (%dz bytes)", size);
|
||||||
#endif
|
#endif
|
||||||
return SAM_TOO_BIG;
|
return SAM_TOO_BIG;
|
||||||
}
|
}
|
||||||
@@ -197,7 +197,7 @@ samerr_t sam_dgram_send(const sam_pubkey_t dest, const void *data, size_t size)
|
|||||||
snprintf(cmd, sizeof cmd, "DATAGRAM SEND DESTINATION=%s SIZE=%u\n",
|
snprintf(cmd, sizeof cmd, "DATAGRAM SEND DESTINATION=%s SIZE=%u\n",
|
||||||
dest, size);
|
dest, size);
|
||||||
#else
|
#else
|
||||||
snprintf(cmd, sizeof cmd, "DATAGRAM SEND DESTINATION=%s SIZE=%z\n",
|
snprintf(cmd, sizeof cmd, "DATAGRAM SEND DESTINATION=%s SIZE=%dz\n",
|
||||||
dest, size);
|
dest, size);
|
||||||
#endif
|
#endif
|
||||||
sam_write(cmd, strlen(cmd));
|
sam_write(cmd, strlen(cmd));
|
||||||
@@ -957,7 +957,7 @@ samerr_t sam_stream_send(sam_sid_t stream_id, const void *data, size_t size)
|
|||||||
SAMLOG("Invalid data send size (%u bytes) for stream %d",
|
SAMLOG("Invalid data send size (%u bytes) for stream %d",
|
||||||
size, stream_id);
|
size, stream_id);
|
||||||
#else
|
#else
|
||||||
SAMLOG("Invalid data send size (%z bytes) for stream %d",
|
SAMLOG("Invalid data send size (%dz bytes) for stream %d",
|
||||||
size, stream_id);
|
size, stream_id);
|
||||||
#endif
|
#endif
|
||||||
return SAM_TOO_BIG;
|
return SAM_TOO_BIG;
|
||||||
@@ -971,7 +971,7 @@ samerr_t sam_stream_send(sam_sid_t stream_id, const void *data, size_t size)
|
|||||||
stream_id, size);
|
stream_id, size);
|
||||||
#endif
|
#endif
|
||||||
#else
|
#else
|
||||||
snprintf(cmd, sizeof cmd, "STREAM SEND ID=%d SIZE=%z\n",
|
snprintf(cmd, sizeof cmd, "STREAM SEND ID=%d SIZE=%dz\n",
|
||||||
stream_id, size);
|
stream_id, size);
|
||||||
#endif
|
#endif
|
||||||
sam_write(cmd, strlen(cmd));
|
sam_write(cmd, strlen(cmd));
|
||||||
|
Reference in New Issue
Block a user