Makefile (3136B)
1 # 02jun13abu 2 # 27feb08rdo 3 # (c) Software Lab. Alexander Burger 4 5 bin = ../bin 6 lib = ../lib 7 8 picoFiles = main.c gc.c apply.c flow.c sym.c subr.c big.c io.c net.c tab.c 9 10 CFLAGS = -c -O2 -m32 -pipe \ 11 -falign-functions -fomit-frame-pointer -fno-strict-aliasing \ 12 -W -Wimplicit -Wreturn-type -Wunused -Wformat \ 13 -Wuninitialized -Wstrict-prototypes \ 14 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 15 16 17 ifeq ($(shell uname), Linux) 18 OS = Linux 19 PICOLISP-FLAGS = -m32 -rdynamic 20 LIB-FLAGS = -lc -lm -ldl 21 DYNAMIC-LIB-FLAGS = -m32 -shared -export-dynamic 22 LCRYPT = -lcrypt 23 STRIP = strip 24 else 25 ifeq ($(shell uname), OpenBSD) 26 OS = OpenBSD 27 PICOLISP-FLAGS = -m32 -rdynamic -Wl,-E 28 LIB-FLAGS = -lc -lm 29 DYNAMIC-LIB-FLAGS = -Wl,-E -Wl,-shared 30 LCRYPT = -lcrypto 31 STRIP = strip 32 else 33 ifeq ($(shell uname), FreeBSD) 34 OS = FreeBSD 35 PICOLISP-FLAGS = -m32 -rdynamic 36 LIB-FLAGS = -lc -lm 37 DYNAMIC-LIB-FLAGS = -m32 -shared -export-dynamic 38 LCRYPT = -lcrypto 39 STRIP = strip 40 else 41 ifeq ($(shell uname), NetBSD) 42 OS = NetBSD 43 PICOLISP-FLAGS = -m32 -rdynamic 44 LIB-FLAGS = -lc -lm 45 DYNAMIC-LIB-FLAGS = -m32 -shared -export-dynamic 46 LCRYPT = -lcrypto 47 STRIP = strip 48 else 49 ifeq ($(shell uname), Darwin) 50 OS = Darwin 51 PICOLISP-FLAGS = -m32 52 LIB-FLAGS = -lc -lm -ldl 53 DYNAMIC-LIB-FLAGS = -m32 -dynamiclib -undefined dynamic_lookup 54 LCRYPT = -lcrypto 55 STRIP = strip -x 56 else 57 ifeq ($(shell uname -o), Cygwin) 58 OS = Cygwin 59 DYNAMIC-LIB-FLAGS = -shared 60 PICOLISP-FLAGS = 61 DLL-DEFS = $(bin)/picolisp.dll 62 LCRYPT = -lcrypt 63 STRIP = strip 64 exe = .exe 65 dll = .dll 66 endif 67 endif 68 endif 69 endif 70 endif 71 endif 72 73 74 picolisp: $(bin)/picolisp $(lib)/ext$(dll) $(lib)/ht$(dll) 75 tools: $(bin)/lat1 $(bin)/utf2 $(bin)/balance 76 gate: $(bin)/ssl $(bin)/httpGate 77 78 all: picolisp tools gate 79 80 .c.o: 81 gcc $(CFLAGS) -D_OS='"$(OS)"' $*.c 82 83 84 $(picoFiles:.c=.o) ext.o ht.o: pico.h 85 main.o: vers.h 86 87 88 ifeq ($(OS), Cygwin) 89 90 $(bin)/picolisp$(dll): $(picoFiles:.c=.o) 91 gcc -o $(bin)/picolisp$(dll) $(DYNAMIC-LIB-FLAGS) $(picoFiles:.c=.o) 92 $(STRIP) $(bin)/picolisp$(dll) 93 94 $(bin)/picolisp: $(picoFiles:.c=.o) $(bin)/picolisp$(dll) start.o 95 mkdir -p $(bin) $(lib) 96 gcc -o $(bin)/picolisp$(exe) $(PICOLISP-FLAGS) start.o -L$(bin) -l$(bin)/picolisp 97 $(STRIP) $(bin)/picolisp$(exe) 98 99 else 100 101 $(bin)/picolisp: $(picoFiles:.c=.o) 102 mkdir -p $(bin) $(lib) 103 gcc -o $(bin)/picolisp$(exe) $(PICOLISP-FLAGS) $(picoFiles:.c=.o) $(LIB-FLAGS) 104 $(STRIP) $(bin)/picolisp$(exe) 105 106 endif 107 108 109 $(lib)/ext$(dll): ext.o 110 gcc -o $(lib)/ext$(dll) $(DYNAMIC-LIB-FLAGS) ext.o $(DLL-DEFS) $(LCRYPT) 111 $(STRIP) $(lib)/ext$(dll) 112 113 $(lib)/ht$(dll): ht.o 114 gcc -o $(lib)/ht$(dll) $(DYNAMIC-LIB-FLAGS) ht.o $(DLL-DEFS) 115 $(STRIP) $(lib)/ht$(dll) 116 117 118 $(bin)/lat1: lat1.c 119 gcc -o $(bin)/lat1$(exe) lat1.c 120 $(STRIP) $(bin)/lat1$(exe) 121 122 $(bin)/utf2: utf2.c 123 gcc -o $(bin)/utf2$(exe) utf2.c 124 $(STRIP) $(bin)/utf2$(exe) 125 126 $(bin)/balance: balance.c 127 gcc -o $(bin)/balance$(exe) balance.c 128 $(STRIP) $(bin)/balance$(exe) 129 130 $(bin)/ssl: ssl.c 131 gcc -o $(bin)/ssl$(exe) ssl.c -lssl -lcrypto 132 $(STRIP) $(bin)/ssl$(exe) 133 134 $(bin)/httpGate: httpGate.c 135 gcc -o $(bin)/httpGate$(exe) httpGate.c -lssl -lcrypto 136 $(STRIP) $(bin)/httpGate$(exe) 137 138 139 # Clean up 140 clean: 141 rm -f *.o 142 143 # vi:noet:ts=4:sw=4