NASM 0.95
[platform/upstream/nasm.git] / Makefile
1 # Makefile for the Netwide Assembler
2 #
3 # The Netwide Assembler is copyright (C) 1996 Simon Tatham and
4 # Julian Hall. All rights reserved. The software is
5 # redistributable under the licence given in the file "Licence"
6 # distributed in the NASM archive.
7 #
8 # This Makefile is designed for use under Unix (probably fairly
9 # portably). It can also be used without change to build NASM using
10 # DJGPP. The makefile "Makefile.dos" can be used to build NASM using
11 # a 16-bit DOS C compiler such as Microsoft C.
12 #
13 # The `make dist' section at the end of the Makefile is not
14 # guaranteed to work anywhere except Linux. Come to think of it,
15 # I'm not sure I want to guarantee it to work anywhere except on
16 # _my_ computer. :-)
17
18 CC = gcc
19 CCFLAGS = -c -g -O -Wall -ansi -pedantic
20 LINK = gcc
21 LINKFLAGS = -o nasm
22 DLINKFLAGS = -o ndisasm
23 LIBRARIES =
24 STRIP = strip
25 EXE =#
26 OBJ = o#
27
28 .c.$(OBJ):
29         $(CC) $(CCFLAGS) $*.c
30
31 NASMOBJS = nasm.$(OBJ) nasmlib.$(OBJ) float.$(OBJ) insnsa.$(OBJ) \
32            assemble.$(OBJ) labels.$(OBJ) parser.$(OBJ) outform.$(OBJ) \
33            outbin.$(OBJ) outaout.$(OBJ) outcoff.$(OBJ) outelf.$(OBJ) \
34            outobj.$(OBJ) outas86.$(OBJ) outrdf.$(OBJ) outdbg.$(OBJ) \
35            preproc.$(OBJ) listing.$(OBJ)
36
37 NDISASMOBJS = ndisasm.$(OBJ) disasm.$(OBJ) sync.$(OBJ) nasmlib.$(OBJ) \
38               insnsd.$(OBJ)
39
40 all : nasm$(EXE) ndisasm$(EXE)
41
42 nasm$(EXE): $(NASMOBJS)
43         $(LINK) $(LINKFLAGS) $(NASMOBJS) $(LIBRARIES)
44
45 ndisasm$(EXE): $(NDISASMOBJS)
46         $(LINK) $(DLINKFLAGS) $(NDISASMOBJS) $(LIBRARIES)
47
48 assemble.$(OBJ): assemble.c nasm.h nasmlib.h assemble.h insns.h
49 disasm.$(OBJ): disasm.c nasm.h disasm.h sync.h insns.h names.c
50 float.$(OBJ): float.c nasm.h
51 insnsa.$(OBJ): insnsa.c nasm.h insns.h
52 insnsd.$(OBJ): insnsd.c nasm.h insns.h
53 labels.$(OBJ): labels.c nasm.h nasmlib.h
54 listing.$(OBJ): listing.c nasm.h nasmlib.h listing.h
55 macros.$(OBJ): macros.c
56 names.$(OBJ): names.c
57 nasm.$(OBJ): nasm.c nasm.h nasmlib.h preproc.h parser.h assemble.h labels.h \
58  outform.h listing.h
59 nasmlib.$(OBJ): nasmlib.c nasm.h nasmlib.h
60 ndisasm.$(OBJ): ndisasm.c nasm.h nasmlib.h sync.h disasm.h
61 outaout.$(OBJ): outaout.c nasm.h nasmlib.h outform.h
62 outas86.$(OBJ): outas86.c nasm.h nasmlib.h outform.h
63 outbin.$(OBJ): outbin.c nasm.h nasmlib.h outform.h
64 outcoff.$(OBJ): outcoff.c nasm.h nasmlib.h outform.h
65 outdbg.$(OBJ): outdbg.c nasm.h nasmlib.h outform.h
66 outelf.$(OBJ): outelf.c nasm.h nasmlib.h outform.h
67 outform.$(OBJ): outform.c outform.h nasm.h
68 outobj.$(OBJ): outobj.c nasm.h nasmlib.h outform.h
69 outrdf.$(OBJ): outrdf.c nasm.h nasmlib.h outform.h
70 parser.$(OBJ): parser.c nasm.h nasmlib.h parser.h float.h names.c
71 preproc.$(OBJ): preproc.c nasm.h nasmlib.h macros.c
72 sync.$(OBJ): sync.c sync.h
73
74 # These two source files are automagically generated from a single
75 # instruction-table file by a Perl script. They're distributed,
76 # though, so it isn't necessary to have Perl just to recompile NASM
77 # from the distribution.
78
79 AUTOSRCS = insnsa.c insnsd.c
80 $(AUTOSRCS): insns.dat insns.pl
81         perl insns.pl
82
83 # This source file is generated from the standard macros file
84 # `standard.mac' by another Perl script. Again, it's part of the
85 # standard distribution.
86
87 macros.c: standard.mac
88         perl macros.pl
89
90 # Clean the whole thing up after compilation.
91
92 clean :
93         rm -f $(NASMOBJS) $(NDISASMOBJS) nasm$(EXE) ndisasm$(EXE)
94         make -C rdoff clean
95         make -C test clean
96
97 # Here the `make dist' section begins. Nothing is guaranteed hereafter
98 # unless you're using the Makefile under Linux, running bash, with
99 # gzip, GNU tar and a sensible version of zip readily available.
100
101 MANPAGES = nasm.man ndisasm.man
102
103 .SUFFIXES: .man .1
104
105 .1.man:
106         -man ./$< | ul > $@
107
108 dist: $(AUTOSRCS) $(MANPAGES) clean
109         makedist.sh