1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178
|
# 1. edit you OS if you want....
OS=LINUX
#OS=BEOS
#OS=FREEBSD
#OS=OPENBSD
#OS=QNX
#OS=ATHEOS
#OS=W32 ** please use a separate make.bat for W9x **
#OS=NETBSD
# Set this to gzexe or upx if you want compression
# COMPRESS=gzexe
# COMPRESS=upx
# 2. edit dest dir prefix if you want....
PREFIX='/usr/local'
#PREFIX=/boot/home
# 3. for vi friends only (else leave as is):
# choice between '/bin/ex' or default '/bin/sed'
EXMODE=SED
#EXMODE=EX
BINDIR='$(PREFIX)/bin'
MANSEC='1'
MANDIR='$(PREFIX)/share/man/man$(MANSEC)'
#______________________do not edit below line________________________
ASOURCES=e3.asm e3.h
AFLAGS = -w+orphan-labels -f elf
NASM=nasm -O2
all: e3
e3: $(ASOURCES) Makefile
ifeq ($(OS),LINUX)
$(NASM) -f bin -l e3.lst -o e3 e3.asm -DCRIPLED_ELF=1 -D$(OS) -D$(EXMODE) -DNASM
chmod +x e3
ifeq ($(COMPRESS),upx)
if which upx > /dev/null 2>&1 ; then \
upx -q -q -q -k -9 e3 ; \
fi ;
endif
ifeq ($(COMPRESS),gzexe)
if which gzexe > /dev/null 2>&1 ; then gzexe e3; fi;
endif
else
echo $(ASVER)
$(NASM) $(AFLAGS) -o e3.o e3.asm -l e3.lst -D$(OS) -D$(EXMODE) -DNASM
ifeq ($(OS),QNX)
ld -s -o e3 e3.o -lc
else
ld -s -o e3 e3.o
endif
strip --remove-section .comment e3
endif
# next for running in gnu debugger
debug: $(ASOURCES) Makefile
$(NASM) $(AFLAGS) -g -o e3.o e3.asm -l e3.lst -D$(OS) -D$(EXMODE) -DNASM
ld -b elf32-i386 --oformat elf32-i386 -s -o e3 e3.o
strip --remove-section .comment e3
ln -sf e3 e3ws
ln -sf e3 e3em
ln -sf e3 e3pi
ln -sf e3 e3vi
ln -sf e3 e3ne
# L I N U X only
# Experimental stuff for using YASM assembler
# needs some sed changes (jmp vs jmp near) due heavy bugs in YASM optimizer
# (how to switch off that optimizer ?)
yasm: $(ASOURCES) Makefile
cat e3.asm | sed -f e3_nasm_yasm.sed > e3.tmp
yasm -a x86 -m x86 -f elf32 -p nasm $(AFLAGS) -l e3.lstyasm -o e3.o -DLINUX -DSED -DYASM e3.tmp
rm e3.tmp
ld -b elf32-i386 --oformat elf32-i386 -s -o e3 e3.o
ln -sf e3 e3ws
ln -sf e3 e3em
ln -sf e3 e3pi
ln -sf e3 e3vi
ln -sf e3 e3ne
# L I N U X / AMD-64 only
# ditto YASM stuff
yasm64: $(ASOURCES) Makefile
cat e3.asm | sed -f e3_nasm_yasm.sed \
| sed -f e3_yasm_yasm64.sed >e3.tmp
yasm -a x86 -m amd64 -f elf64 -p nasm -L nasm $(AFLAGS) \
-l e3.lstyasm64 -o e3.o -DLINUX -DSED -DYASM -DAMD64 e3.tmp
rm e3.tmp
ld -b elf64-x86-64 --oformat elf64-x86-64 -s -o e3 e3.o
ln -sf e3 e3ws
ln -sf e3 e3em
ln -sf e3 e3pi
ln -sf e3 e3vi
ln -sf e3 e3ne
# L I N U X only
# Experimental stuff for using NASM assembler
nasm64: $(ASOURCES) Makefile
cat e3.asm | sed -f e3_nasm_yasm.sed \
| sed -f e3_yasm_yasm64.sed >e3.tmp
$(NASM) -w+orphan-labels -f elf64 -o e3.o e3.tmp -l e3.lst64 -DLINUX -DSED -DYASM -DAMD64 -DNASM
rm e3.tmp
ld -b elf64-x86-64 --oformat elf64-x86-64 -s -o e3 e3.o
ln -sf e3 e3ws
ln -sf e3 e3em
ln -sf e3 e3pi
ln -sf e3 e3vi
ln -sf e3 e3ne
# added for compatibility reason:
nasm32: e3
# next for cross asm for the ELKS people
elks:
nasm -w+orphan-labels -f as86 -o e3-16.o e3-16.asm -l e3-16.lst -D AS86 -D ELKS -DNASM
ld86 -0 -s -i -H 0xF800 -o e3-16 e3-16.o
# next two for cross asm testing
w32lst:
$(NASM) -f coff -o e3.oW32 e3.asm -l e3.lstW32 -DW32 -DNASM
rm e3.oW32
qnxlst:
$(NASM) -f elf -o e3.oQNX e3.asm -l e3.lstQNX -DQNX -DNASM
rm e3.oQNX
# next for release maintainance
man2html:
rman -f HTML e3.man >e3.html
install: e3
ifeq ($(OS),QNX)
cp ./e3 $(BINDIR)/e3
ln -sf $(BINDIR)/e3 $(BINDIR)/e3ws
ln -sf $(BINDIR)/e3 $(BINDIR)/e3em
ln -sf $(BINDIR)/e3 $(BINDIR)/e3pi
ln -sf $(BINDIR)/e3 $(BINDIR)/e3vi
ln -sf $(BINDIR)/e3 $(BINDIR)/e3ne
else
install -d $(PREFIX) $(BINDIR) $(MANDIR)
install -m 755 e3 $(BINDIR)
cd $(BINDIR) && ln -s e3 e3ws
cd $(BINDIR) && ln -s e3 e3em
cd $(BINDIR) && ln -s e3 e3pi
cd $(BINDIR) && ln -s e3 e3vi
cd $(BINDIR) && ln -s e3 e3ne
install -m 644 e3.man $(MANDIR)/e3.$(MANSEC)
cd $(MANDIR) && ln -s e3.1 e3ws.1
cd $(MANDIR) && ln -s e3.1 e3em.1
cd $(MANDIR) && ln -s e3.1 e3pi.1
cd $(MANDIR) && ln -s e3.1 e3vi.1
cd $(MANDIR) && ln -s e3.1 e3ne.1
endif
armlinux: e3
@cd armlinux && make all
clean:
-rm -f e3*.o e3*.lst e3 e3em e3pi e3vi e3ws e3ne *~ \
PIPE_IN e3test~ e3test e3dync e3dync2 e3statc \
armlinux/*.o armlinux/e3arm
|