Home | History | Annotate | Download | only in Mkfiles
      1 # Ultra-flat Makefile "prototype" for non-Unix platforms.
      2 # Does NOT depend on or use configure.
      3 #
      4 # Works for simple build but *not* for development (no clean, dist, etc).
      5 # Also, WARNING, no header dependencies are included!
      6 #
      7 # NOTE: Needs a valid config.h for the platform being compiled on.
      8 #
      9 # This file should be customized to particular platforms by changing CC and
     10 #  CFLAGS appropriately, along with writing a config.h and _stdint.h for the
     11 #  platform and placing them in a subdirectory of Mkfiles.
     12 
     13 CFLAGS=-DHAVE_CONFIG_H -IMkfiles -I.
     14 CC?=gcc
     15 BUILDCC?=$(CC)
     16 
     17 all: yasm ytasm vsyasm
     18 
     19 LIBYASM_OBJS= \
     20  libyasm/assocdat.o \
     21  libyasm/bitvect.o \
     22  libyasm/bc-align.o \
     23  libyasm/bc-data.o \
     24  libyasm/bc-incbin.o \
     25  libyasm/bc-org.o \
     26  libyasm/bc-reserve.o \
     27  libyasm/bytecode.o \
     28  libyasm/errwarn.o \
     29  libyasm/expr.o \
     30  libyasm/file.o \
     31  libyasm/floatnum.o \
     32  libyasm/hamt.o \
     33  libyasm/insn.o \
     34  libyasm/intnum.o \
     35  libyasm/inttree.o \
     36  libyasm/linemap.o \
     37  libyasm/md5.o \
     38  libyasm/mergesort.o \
     39  libyasm/phash.o \
     40  libyasm/section.o \
     41  libyasm/strcasecmp.o \
     42  libyasm/strsep.o \
     43  libyasm/symrec.o \
     44  libyasm/valparam.o \
     45  libyasm/value.o \
     46  libyasm/xmalloc.o \
     47  libyasm/xstrdup.o \
     48  module.o
     49 
     50 MODULES_ARCH_X86_OBJS= \
     51  modules/arch/x86/x86arch.o \
     52  modules/arch/x86/x86bc.o \
     53  modules/arch/x86/x86expr.o \
     54  modules/arch/x86/x86id.o \
     55  x86cpu.o \
     56  x86regtmod.o
     57 YASM_MODULES=arch_x86
     58 
     59 MODULES_ARCH_LC3B_OBJS= \
     60  modules/arch/lc3b/lc3barch.o \
     61  modules/arch/lc3b/lc3bbc.o \
     62  lc3bid.o
     63 YASM_MODULES+=arch_lc3b
     64 
     65 MODULES_ARCH_OBJS= \
     66  $(MODULES_ARCH_X86_OBJS) \
     67  $(MODULES_ARCH_LC3B_OBJS)
     68 
     69 MODULES_DBGFMTS_OBJS= \
     70  modules/dbgfmts/null/null-dbgfmt.o \
     71  modules/dbgfmts/stabs/stabs-dbgfmt.o \
     72  modules/dbgfmts/codeview/cv-dbgfmt.o \
     73  modules/dbgfmts/codeview/cv-symline.o \
     74  modules/dbgfmts/codeview/cv-type.o \
     75  modules/dbgfmts/dwarf2/dwarf2-dbgfmt.o \
     76  modules/dbgfmts/dwarf2/dwarf2-line.o \
     77  modules/dbgfmts/dwarf2/dwarf2-info.o \
     78  modules/dbgfmts/dwarf2/dwarf2-aranges.o
     79 YASM_MODULES+=dbgfmt_null
     80 YASM_MODULES+=dbgfmt_stabs
     81 YASM_MODULES+=dbgfmt_cv8
     82 YASM_MODULES+=dbgfmt_dwarf2
     83 
     84 MODULES_LISTFMTS_OBJS= \
     85  modules/listfmts/nasm/nasm-listfmt.o
     86 YASM_MODULES+=listfmt_nasm
     87 
     88 MODULES_OBJFMTS_OBJS= \
     89  modules/objfmts/dbg/dbg-objfmt.o \
     90  modules/objfmts/bin/bin-objfmt.o \
     91  modules/objfmts/coff/coff-objfmt.o \
     92  modules/objfmts/coff/win64-except.o \
     93  modules/objfmts/elf/elf.o \
     94  modules/objfmts/elf/elf-x86-x86.o \
     95  modules/objfmts/elf/elf-x86-amd64.o \
     96  modules/objfmts/elf/elf-objfmt.o \
     97  modules/objfmts/macho/macho-objfmt.o \
     98  modules/objfmts/rdf/rdf-objfmt.o \
     99  modules/objfmts/xdf/xdf-objfmt.o
    100 YASM_MODULES+=objfmt_dbg
    101 YASM_MODULES+=objfmt_bin objfmt_dosexe
    102 YASM_MODULES+=objfmt_coff objfmt_win32 objfmt_win64 objfmt_x64
    103 YASM_MODULES+=objfmt_elf objfmt_elf32 objfmt_elf64
    104 YASM_MODULES+=objfmt_macho objfmt_macho32 objfmt_macho64
    105 YASM_MODULES+=objfmt_rdf
    106 YASM_MODULES+=objfmt_xdf
    107 
    108 MODULES_PARSERS_OBJS= \
    109  modules/parsers/nasm/nasm-parser.o \
    110  modules/parsers/nasm/nasm-parse.o \
    111  nasm-token.o \
    112  modules/parsers/gas/gas-parser.o \
    113  modules/parsers/gas/gas-parse-intel.o \
    114  modules/parsers/gas/gas-parse.o \
    115  gas-token.o
    116 YASM_MODULES+=parser_nasm parser_tasm
    117 YASM_MODULES+=parser_gas parser_gnu
    118 
    119 MODULES_PREPROCS_NASM_OBJS= \
    120  modules/preprocs/nasm/nasm-eval.o \
    121  modules/preprocs/nasm/nasm-pp.o \
    122  modules/preprocs/nasm/nasm-preproc.o \
    123  modules/preprocs/nasm/nasmlib.o
    124 YASM_MODULES+=preproc_nasm preproc_tasm
    125 
    126 MODULES_PREPROCS_RAW_OBJS = \
    127  modules/preprocs/raw/raw-preproc.o
    128 YASM_MODULES+=preproc_raw
    129 
    130 MODULES_PREPROCS_CPP_OBJS = \
    131  modules/preprocs/cpp/cpp-preproc.o
    132 YASM_MODULES+=preproc_cpp
    133 
    134 MODULES_PREPROCS_GAS_OBJS = \
    135  modules/preprocs/gas/gas-eval.o \
    136  modules/preprocs/gas/gas-preproc.o
    137 YASM_MODULES+=preproc_gas
    138 
    139 MODULES_PREPROCS_OBJS = \
    140  $(MODULES_PREPROCS_NASM_OBJS) \
    141  $(MODULES_PREPROCS_RAW_OBJS) \
    142  $(MODULES_PREPROCS_CPP_OBJS) \
    143  $(MODULES_PREPROCS_GAS_OBJS)
    144 
    145 MODULES_OBJS = \
    146  $(MODULES_ARCH_OBJS) \
    147  $(MODULES_DBGFMTS_OBJS) \
    148  $(MODULES_LISTFMTS_OBJS) \
    149  $(MODULES_OBJFMTS_OBJS) \
    150  $(MODULES_OPTIMIZERS_OBJS) \
    151  $(MODULES_PARSERS_OBJS) \
    152  $(MODULES_PREPROCS_OBJS)
    153 
    154 YASM_OBJS= \
    155  frontends/yasm/yasm.o \
    156  frontends/yasm/yasm-options.o \
    157  $(LIBYASM_OBJS) \
    158  $(MODULES_OBJS)
    159 
    160 YTASM_OBJS= \
    161  frontends/tasm/tasm.o \
    162  frontends/tasm/tasm-options.o \
    163  $(LIBYASM_OBJS) \
    164  $(MODULES_OBJS)
    165 
    166 VSYASM_OBJS= \
    167  frontends/vsyasm/vsyasm.o \
    168  frontends/yasm/yasm-options.o \
    169  $(LIBYASM_OBJS) \
    170  $(MODULES_OBJS)
    171 
    172 genstring: genstring.c
    173 	$(BUILDCC) -o $@ $<
    174 
    175 license.c: COPYING genstring
    176 	./genstring license_msg $@ COPYING
    177 
    178 frontends/yasm/yasm.c: license.c
    179 
    180 genmacro: tools/genmacro/genmacro.c
    181 	$(BUILDCC) -o $@ $<
    182 
    183 nasm-version.c: version.mac genmacro
    184 	./genmacro $@ nasm_version_mac version.mac
    185 
    186 modules/preprocs/nasm/nasm-pp.c: nasm-version.c
    187 
    188 nasm-macros.c: modules/parsers/nasm/nasm-std.mac genmacro
    189 	./genmacro $@ nasm_standard_mac modules/parsers/nasm/nasm-std.mac
    190 
    191 modules/parsers/nasm/nasm-parser.c: nasm-macros.c
    192 
    193 win64-nasm.c: modules/objfmts/coff/win64-nasm.mac genmacro
    194 	./genmacro $@ win64_nasm_stdmac modules/objfmts/coff/win64-nasm.mac
    195 win64-gas.c: modules/objfmts/coff/win64-gas.mac genmacro
    196 	./genmacro $@ win64_gas_stdmac modules/objfmts/coff/win64-gas.mac
    197 
    198 modules/objfmts/coff/coff-objfmt.c: win64-nasm.c win64-gas.c
    199 
    200 genversion: modules/preprocs/nasm/genversion.c YASM-VERSION.h
    201 	$(BUILDCC) -IMkfiles -I. -o $@ $<
    202 
    203 version.mac: genversion
    204 	./genversion $@
    205 
    206 genmodule: libyasm/genmodule.c
    207 	$(BUILDCC) -o $@ $<
    208 
    209 module.c: libyasm/module.in genmodule
    210 	./genmodule libyasm/module.in Mkfiles/Makefile.flat
    211 
    212 x86insn_nasm.gperf x86insn_gas.gperf x86insns.c: modules/arch/x86/gen_x86_insn.py
    213 	# ignore error in case python is not installed
    214 	-python modules/arch/x86/gen_x86_insn.py
    215 
    216 x86insn_nasm.c: x86insn_nasm.gperf genperf
    217 	./genperf x86insn_nasm.gperf $@
    218 
    219 x86insn_gas.c: x86insn_gas.gperf genperf
    220 	./genperf x86insn_gas.gperf $@
    221 
    222 x86cpu.c: modules/arch/x86/x86cpu.gperf genperf
    223 	./genperf modules/arch/x86/x86cpu.gperf $@
    224 
    225 x86regtmod.c: modules/arch/x86/x86regtmod.gperf genperf
    226 	./genperf modules/arch/x86/x86regtmod.gperf $@
    227 
    228 modules/arch/x86/x86id.c: x86insn_nasm.c x86insn_gas.c x86insns.c
    229 
    230 lc3bid.c: modules/arch/lc3b/lc3bid.re re2c
    231 	./re2c -s -o $@ modules/arch/lc3b/lc3bid.re
    232 
    233 gas-token.c: modules/parsers/gas/gas-token.re re2c
    234 	./re2c -b -o $@ modules/parsers/gas/gas-token.re
    235 
    236 nasm-token.c: modules/parsers/nasm/nasm-token.re re2c
    237 	./re2c -b -o $@ modules/parsers/nasm/nasm-token.re
    238 
    239 RE2C_SRCS= \
    240 	tools/re2c/main.c \
    241 	tools/re2c/code.c \
    242 	tools/re2c/dfa.c \
    243 	tools/re2c/parser.c \
    244 	tools/re2c/actions.c \
    245 	tools/re2c/scanner.c \
    246 	tools/re2c/mbo_getopt.c \
    247 	tools/re2c/substr.c \
    248 	tools/re2c/translate.c
    249 
    250 re2c: $(RE2C_SRCS)
    251 	$(BUILDCC) -I. -o re2c $(RE2C_SRCS)
    252 
    253 GENPERF_SRCS= \
    254 	tools/genperf/genperf.c \
    255 	tools/genperf/perfect.c \
    256 	libyasm/phash.c \
    257 	libyasm/xmalloc.c \
    258 	libyasm/xstrdup.c
    259 
    260 genperf: $(GENPERF_SRCS)
    261 	$(BUILDCC) -I. -o genperf $(GENPERF_SRCS)
    262 
    263 yasm: $(YASM_OBJS)
    264 	$(CC) -o yasm $(YASM_OBJS)
    265 
    266 ytasm: $(YTASM_OBJS)
    267 	$(CC) -o ytasm $(YTASM_OBJS)
    268 
    269 vsyasm: $(VSYASM_OBJS)
    270 	$(CC) -o vsyasm $(VSYASM_OBJS)
    271 
    272 .c.o:
    273 	$(CC) -c $(CFLAGS) -o $@ $<
    274 
    275 $(YASM_OBJS) $(YTASM_OBJS) $(VSYASM_OBJS): YASM-VERSION.h
    276 
    277 YASM-VERSION.h: YASM-VERSION-GEN.sh
    278 	sh YASM-VERSION-GEN.sh
    279 
    280