| 1 |
# $Id$ |
| 2 |
# |
| 3 |
# Usage: make [DEBUG=1] [NOFORK=1] [PERL=1] [PERLDL=1] |
| 4 |
# [ZLIB=1] [BZLIB2=1] [ZLIBDL=1] [BW_LIM=1] |
| 5 |
# |
| 6 |
# Tested with perl 5.0053 |
| 7 |
# |
| 8 |
|
| 9 |
CC=gcc |
| 10 |
IMPLIB=emximp |
| 11 |
DEFINES=-DHAVE_FORK -DHAVE_SNPRINTF -DHAVE_VSNPRINTF -DHAVE_GETOPT -DHAVE_UNISTD -DOS2=2 -DHAVE_IO_H -DHAVE_ARPA_INET_H -DHAVE_SYS_TIME_H -DHAVE_SYS_PARAM_H -DHAVE_SYS_IOCTL_H -DHAVE_DOS_H -DHAVE_STDARG_H -DEMX -DEMXSIGNALS -DHAVE_WAITPID -DHAVE_GETTIMEOFDAY -DHTTPS -DNTLM -DAMIGADOS_4D_OUTBOUND -DHAVE_NETINET_IN_H -DHAVE_NETDB_H -DHAVE_RESOLV_H -DHAVE_ARPA_NAMESER_H -Du_int16_t=u_short -Du_int32_t=u_int |
| 12 |
CFLAGS=$(DEFINES) -Wall -funsigned-char -Wno-char-subscripts |
| 13 |
LFLAGS=-Los2 |
| 14 |
LIBS=-lsocket -lresolv |
| 15 |
NTLM_SRC=ntlm/des_enc.c ntlm/helpers.c ntlm/ecb_enc.c ntlm/md4_dgst.c ntlm/set_key.c |
| 16 |
SRCS=binkd.c readcfg.c tools.c ftnaddr.c ftnq.c client.c server.c protocol.c bsy.c inbound.c breaksig.c branch.c os2/gettid.c os2/sem.c ftndom.c ftnnode.c os2/getfree.c srif.c pmatch.c readflo.c prothlp.c iptools.c rfc2553.c run.c binlog.c exitproc.c getw.c xalloc.c setpttl.c https.c md5b.c crypt.c srv_gai.c os2/ns_parse.c ${NTLM_SRC} |
| 17 |
TARGET=binkd2emx |
| 18 |
|
| 19 |
#PERLDIR=../perl5.00553/os2 |
| 20 |
#ZLIB_DIR=../zlib-1.2.11 |
| 21 |
#BZLIB2_DIR=../bzip2-1.0.6 |
| 22 |
|
| 23 |
ifdef DEBUG |
| 24 |
TARGET:=$(TARGET)-debug |
| 25 |
CFLAGS+=-g -DDEBUG |
| 26 |
LFLAGS+=-g |
| 27 |
else |
| 28 |
CFLAGS+=-O2 -s |
| 29 |
LFLAGS+=-O2 -s |
| 30 |
endif |
| 31 |
|
| 32 |
ifdef NOFORK |
| 33 |
TARGET:=$(TARGET)-nofork |
| 34 |
CFLAGS+=-DDEBUGCHILD |
| 35 |
endif |
| 36 |
|
| 37 |
ifdef PERLDL |
| 38 |
TARGET:=$(TARGET)-perldl |
| 39 |
ifndef PERLDIR |
| 40 |
PERLDIR=$(shell perl -MConfig -e "print $$Config{archlib}") |
| 41 |
endif |
| 42 |
CFLAGS+= -Zmt -DWITH_PERL -DPERLDL -DDOSISH -DPERL_IS_AOUT -DEMBED -I$(PERLDIR)/CORE |
| 43 |
LFLAGS+= -Zmt -Zcrtdll -Zstack 16000 |
| 44 |
SRCS+= perlhooks.c |
| 45 |
else |
| 46 |
ifdef PERL |
| 47 |
TARGET:=$(TARGET)-perl |
| 48 |
ifndef PERLDIR |
| 49 |
PERLDIR=$(shell perl -MConfig -e "print $$Config{archlib}") |
| 50 |
endif |
| 51 |
CFLAGS+= -DWITH_PERL -DDOSISH -DPERL_IS_AOUT -DEMBED -I$(PERLDIR)/CORE |
| 52 |
LFLAGS+= -L$(PERLDIR)/CORE -Zsmall-conv -Zstack 16000 |
| 53 |
LIBS:=$(PERLDIR)/auto/DB_File/DB_File.a \ |
| 54 |
$(PERLDIR)/auto/SDBM_File/SDBM_File.a \ |
| 55 |
$(PERLDIR)/auto/Fcntl/Fcntl.a \ |
| 56 |
$(PERLDIR)/auto/IO/IO.a \ |
| 57 |
$(PERLDIR)/auto/POSIX/POSIX.a \ |
| 58 |
$(PERLDIR)/auto/Socket/Socket.a \ |
| 59 |
$(PERLDIR)/auto/OS2/Process/Process.a \ |
| 60 |
$(PERLDIR)/auto/OS2/ExtAttr/ExtAttr.a \ |
| 61 |
$(PERLDIR)/auto/OS2/REXX/REXX.a \ |
| 62 |
$(PERLDIR)/auto/DynaLoader/DynaLoader.a \ |
| 63 |
-llibperl -lm -lbsd -ldb $(LIBS) |
| 64 |
SRCS+= perlhooks.c |
| 65 |
else |
| 66 |
CFLAGS+= -Zcrtdll |
| 67 |
LFLAGS+= -Zcrtdll |
| 68 |
endif |
| 69 |
endif |
| 70 |
|
| 71 |
ifdef ZLIB |
| 72 |
COMPRESS=1 |
| 73 |
CFLAGS+= -DWITH_ZLIB=1 |
| 74 |
ifdef ZLIB_DIR |
| 75 |
CFLAGS+= -I$(ZLIB_DIR) |
| 76 |
endif |
| 77 |
ifndef ZLIBDL |
| 78 |
TARGET:=$(TARGET)-zlib |
| 79 |
ifndef ZLIB_LIB |
| 80 |
ZLIB_LIB=z_s |
| 81 |
endif |
| 82 |
LIBS:=-l$(ZLIB_LIB) $(LIBS) |
| 83 |
ifdef ZLIB_DIR |
| 84 |
LFLAGS+= -L$(ZLIB_DIR) |
| 85 |
endif |
| 86 |
endif |
| 87 |
endif |
| 88 |
|
| 89 |
ifdef BZLIB2 |
| 90 |
COMPRESS=1 |
| 91 |
CFLAGS+= -DWITH_BZLIB2=1 |
| 92 |
ifdef BZLIB2_DIR |
| 93 |
CFLAGS+= -I$(BZLIB2_DIR) |
| 94 |
endif |
| 95 |
ifndef ZLIBDL |
| 96 |
TARGET:=$(TARGET)-bzlib2 |
| 97 |
ifndef BZLIB2_LIB |
| 98 |
BZLIB2_LIB=libbz2 |
| 99 |
endif |
| 100 |
LIBS:=-l$(BZLIB2_LIB) $(LIBS) |
| 101 |
ifdef BZLIB2_DIR |
| 102 |
LFLAGS+= -L$(BZLIB2_DIR) |
| 103 |
endif |
| 104 |
endif |
| 105 |
endif |
| 106 |
|
| 107 |
ifdef COMPRESS |
| 108 |
SRCS+= compress.c |
| 109 |
endif |
| 110 |
|
| 111 |
ifdef ZLIBDL |
| 112 |
SRCS+= zlibdl.c |
| 113 |
CFLAGS+= -DZLIBDL=1 |
| 114 |
endif |
| 115 |
|
| 116 |
ifdef BW_LIM |
| 117 |
CFLAGS+= -DBW_LIM=1 |
| 118 |
endif |
| 119 |
|
| 120 |
.SUFFIXES: .imp .a |
| 121 |
OBJS=${SRCS:.c=.o} |
| 122 |
|
| 123 |
TARGET:=$(TARGET).exe |
| 124 |
|
| 125 |
all: $(TARGET) |
| 126 |
|
| 127 |
.c.o: |
| 128 |
@echo Compiling $*.c... |
| 129 |
@$(CC) -c $(CFLAGS) -o $*.o $*.c |
| 130 |
|
| 131 |
.imp.a: |
| 132 |
@echo Creating import library from $*.imp |
| 133 |
@$(IMPLIB) -o $*.a $*.imp |
| 134 |
|
| 135 |
$(TARGET): $(OBJS) os2/resolv.a |
| 136 |
@echo Linking $@... |
| 137 |
@$(CC) -o $@ $(LFLAGS) $(OBJS) $(LIBS) |
| 138 |
|
| 139 |
install: all clean |
| 140 |
|
| 141 |
clean: |
| 142 |
-del /n *.RES *.obj *.o os2\*.o ntlm\*.o os2\*.a *.map *~ *.bak *.b *.ini *.err core >nul 2> nul |
| 143 |
|
| 144 |
depend Makefile.dep: |
| 145 |
@echo Build Makefile.dep... |
| 146 |
@gcc -MM $(CFLAGS) $(SRCS) > Makefile.dep |
| 147 |
|
| 148 |
include Makefile.dep |