Print Logo

Compiling AS




<<  <   >  >>

AS is available here. We wrote about AS in this article. AS is a macro assembler that works with many different kinds of CPUs. We put a copy of up here. Here is how to compile AS on a GNU/Linux system:

usr-1@wrk-1 usr-1 $ tar -xzf asl-1.41r8.tar.gz
usr-1@wrk-1 usr-1 $ cd asl*
usr-1@wrk-1 asl-1.41r8 $ ls
BENCHES               code3201x.c   code8x30x.c    findhyphen.h
INSTALL               code3201x.h   code8x30x.h    grhyph.c
Makefile              code3202x.c   code90c141.c   grhyph.h
Makefile.def-samples  code3202x.h   code90c141.h   header.res
Makefile.def.tmpl     code3203x.c   code96.c       headids.c
.
.
.
code17c4x.c           code86.c      endian.h       version.h
code17c4x.h           code86.h      equs.h
code29k.c             code87c800.c  fileformat.h
code29k.h             code87c800.h  findhyphen.c
usr-1@wrk-1 asl-1.41r8 $ 

We need to grab the correct Makefile.def, and modify the CFLAGS for our architecture, and set up the paths:

usr-1@wrk-1 asl-1.41r8 $ ls Makefile.def-samples
MakeDef.cad                            Makefile.def-i386-unknown-os2-visualage
MakeDef.dos                            Makefile.def-i386-unknown-win32
MakeDef.dpmi                           Makefile.def-m68k-pcs-munix3
Makefile.def-alpha-dec-osf13.2         Makefile.def-m68k-sun-netbsd1.2
Makefile.def-alpha-dec-osf14.0         Makefile.def-mips-dec-netbsd1.2
Makefile.def-alpha-unknown-linux2.x.x  Makefile.def-mips-dec-ultrix4.3
Makefile.def-hppa-hp-hpux-10.0         Makefile.def-mips-sgi-irix6.2
Makefile.def-hppa-hp-hpux-9.0          Makefile.def-mips64-sgi-irix6.4
Makefile.def-i386-unknown-dpmi         Makefile.def-rs6k-ibm-aix41
Makefile.def-i386-unknown-linux2.x.x   Makefile.def-sparc-sun-solaris2.x
Makefile.def-i386-unknown-msdos        Makefile.def-sparc-sun-sunos4.1.3
Makefile.def-i386-unknown-os2          Makefile.def-vax-dec-ultrix4.1
usr-1@wrk-1 asl-1.41r8 $ 
usr-1@wrk-1 asl-1.41r8 $ cp Makefile.def-samples/*i386-unknown-linux2* 
./Makefile.def
usr-1@wrk-1 asl-1.41r8 $ 
usr-1@wrk-1 asl-1.41r8 $ vi Makefile.def
# -------------------------------------------------------------------------
# choose your compiler (must be ANSI-compliant!) and linker command, plus
# any additionally needed flags
CC = gcc
LD = gcc
CFLAGS = -march=pentium3 -mcpu=pentium4 -O3 -pipe -fomit-frame-pointer
LDFLAGS =
#            ^^^^^
#            |||||
# adapt this to your target cpu (386/486 or higher)
# -------------------------------------------------------------------------
# directories where binaries, includes, and manpages should go during
# installation
BINDIR = /usr/bin
INCDIR = /usr/include
MANDIR = /usr/man
LIBDIR = /usr/lib/asl
DOCDIR = /usr/doc/asl
# -------------------------------------------------------------------------
# character encoding to use (choose one of them)
CHARSET = CHARSET_ISO8859_1
# CHARSET = CHARSET_ASCII7
# CHARSET = CHARSET_IBM437
usr-1@wrk-1 asl-1.41r8 $ make
gcc -march=pentium3 -mcpu=pentium4 -O3 -pipe -fomit-frame-pointer  
-DCHARSET_ISO8859_1 -DSTDINCLUDES=\"/usr/local/include/asl\" 
-DLIBDIR=\"/usr/local/lib/asl\" -c rescomp.c
gcc -march=pentium3 -mcpu=pentium4 -O3 -pipe -fomit-frame-pointer  
-DCHARSET_ISO8859_1 -DSTDINCLUDES=\"/usr/local/include/asl\" 
-DLIBDIR=\"/usr/local/lib/asl\" -c endian.c
gcc -march=pentium3 -mcpu=pentium4 -O3 -pipe -fomit-frame-pointer  
-DCHARSET_ISO8859_1 -DSTDINCLUDES=\"/usr/local/include/asl\" 
-DLIBDIR=\"/usr/local/lib/asl\" -c strutil.c
gcc -march=pentium3 -mcpu=pentium4 -O3 -pipe -fomit-frame-pointer  
-DCHARSET_ISO8859_1 -DSTDINCLUDES=\"/usr/local/include/asl\" 
-DLIBDIR=\"/usr/local/lib/asl\" -c bpemu.c
gcc -o rescomp rescomp.o endian.o strutil.o bpemu.o 
./rescomp ioerrs.res ioerrs.msg ioerrs.rsc
./rescomp cmdarg.res cmdarg.msg cmdarg.rsc
./rescomp tools.res tools.msg tools.rsc
./rescomp as.res as.msg as.rsc
gcc -march=pentium3 -mcpu=pentium4 -O
.
.
.
-o p2hex p2hex.o version.o toolutils.o headids.o endian.o bpemu.o hex.o 
strutil.o chunks.o cmdarg.o ioerrs.o nls.o nlmessages.o -lm 
./rescomp p2bin.res p2bin.msg p2bin.rsc
gcc -march=pentium3 -mcpu=pentium4 -O3 -pipe -fomit-frame-pointer  
-DCHARSET_ISO8859_1 -DSTDINCLUDES=\"/usr/local/include/asl\" 
-DLIBDIR=\"/usr/local/lib/asl\" -c p2bin.c
gcc -o p2bin p2bin.o version.o toolutils.o endian.o bpemu.o hex.o 
strutil.o chunks.o cmdarg.o ioerrs.o nls.o nlmessages.o -lm 
usr-1@wrk-1 asl-1.41r8 $

Of course, you will want to customize your CFLAGS specific to your computer. We have a Pentium 4.



This article comes from Coprolite:
http://coprolite.com/

The URL for this story is:
http://coprolite.com/art34.html

Copyright 1997-2006 Coprolite.com. Read our Terms of Use.