yasm/Mkfiles/Makefile.flat
Peter Johnson 0ed2cc4451 Generate version number information from git history.
Due to the svn import structure, a special case is currently implemented
to look for the 1.1.0 branchpoint instead of the most recent tag on the
master branch.  This will be removed after the first release is tagged
on the master branch in git.

Specific details:

autogen.sh: More aggressively clean autoconf cache.
This is needed to ensure the version number is actually regenerated.

Don't generate PACKAGE_PATCHLEVEL or PACKAGE_BUILD variables.  The
genversion program now parses PACKAGE_VERSION directly.

For Mkfiles builds, YASM-VERSION.h is generated and included by the custom
config.h.  This avoids the need to edit config.h for versioning.
2011-08-27 09:25:30 -07:00

279 lines
7 KiB
Text

# Ultra-flat Makefile "prototype" for non-Unix platforms.
# Does NOT depend on or use configure.
#
# Works for simple build but *not* for development (no clean, dist, etc).
# Also, WARNING, no header dependencies are included!
#
# NOTE: Needs a valid config.h for the platform being compiled on.
#
# This file should be customized to particular platforms by changing CC and
# CFLAGS appropriately, along with writing a config.h and _stdint.h for the
# platform and placing them in a subdirectory of Mkfiles.
CFLAGS=-DHAVE_CONFIG_H -IMkfiles -I.
CC?=gcc
BUILDCC?=$(CC)
all: yasm ytasm vsyasm
LIBYASM_OBJS= \
libyasm/assocdat.o \
libyasm/bitvect.o \
libyasm/bc-align.o \
libyasm/bc-data.o \
libyasm/bc-incbin.o \
libyasm/bc-org.o \
libyasm/bc-reserve.o \
libyasm/bytecode.o \
libyasm/errwarn.o \
libyasm/expr.o \
libyasm/file.o \
libyasm/floatnum.o \
libyasm/hamt.o \
libyasm/insn.o \
libyasm/intnum.o \
libyasm/inttree.o \
libyasm/linemap.o \
libyasm/md5.o \
libyasm/mergesort.o \
libyasm/phash.o \
libyasm/section.o \
libyasm/strcasecmp.o \
libyasm/strsep.o \
libyasm/symrec.o \
libyasm/valparam.o \
libyasm/value.o \
libyasm/xmalloc.o \
libyasm/xstrdup.o \
module.o
MODULES_ARCH_X86_OBJS= \
modules/arch/x86/x86arch.o \
modules/arch/x86/x86bc.o \
modules/arch/x86/x86expr.o \
modules/arch/x86/x86id.o \
x86cpu.o \
x86regtmod.o
YASM_MODULES=arch_x86
MODULES_ARCH_LC3B_OBJS= \
modules/arch/lc3b/lc3barch.o \
modules/arch/lc3b/lc3bbc.o \
lc3bid.o
YASM_MODULES+=arch_lc3b
MODULES_ARCH_OBJS= \
$(MODULES_ARCH_X86_OBJS) \
$(MODULES_ARCH_LC3B_OBJS)
MODULES_DBGFMTS_OBJS= \
modules/dbgfmts/null/null-dbgfmt.o \
modules/dbgfmts/stabs/stabs-dbgfmt.o \
modules/dbgfmts/codeview/cv-dbgfmt.o \
modules/dbgfmts/codeview/cv-symline.o \
modules/dbgfmts/codeview/cv-type.o \
modules/dbgfmts/dwarf2/dwarf2-dbgfmt.o \
modules/dbgfmts/dwarf2/dwarf2-line.o \
modules/dbgfmts/dwarf2/dwarf2-info.o \
modules/dbgfmts/dwarf2/dwarf2-aranges.o
YASM_MODULES+=dbgfmt_null
YASM_MODULES+=dbgfmt_stabs
YASM_MODULES+=dbgfmt_cv8
YASM_MODULES+=dbgfmt_dwarf2
MODULES_LISTFMTS_OBJS= \
modules/listfmts/nasm/nasm-listfmt.o
YASM_MODULES+=listfmt_nasm
MODULES_OBJFMTS_OBJS= \
modules/objfmts/dbg/dbg-objfmt.o \
modules/objfmts/bin/bin-objfmt.o \
modules/objfmts/coff/coff-objfmt.o \
modules/objfmts/coff/win64-except.o \
modules/objfmts/elf/elf.o \
modules/objfmts/elf/elf-x86-x86.o \
modules/objfmts/elf/elf-x86-amd64.o \
modules/objfmts/elf/elf-objfmt.o \
modules/objfmts/macho/macho-objfmt.o \
modules/objfmts/rdf/rdf-objfmt.o \
modules/objfmts/xdf/xdf-objfmt.o
YASM_MODULES+=objfmt_dbg
YASM_MODULES+=objfmt_bin objfmt_dosexe
YASM_MODULES+=objfmt_coff objfmt_win32 objfmt_win64 objfmt_x64
YASM_MODULES+=objfmt_elf objfmt_elf32 objfmt_elf64
YASM_MODULES+=objfmt_macho objfmt_macho32 objfmt_macho64
YASM_MODULES+=objfmt_rdf
YASM_MODULES+=objfmt_xdf
MODULES_PARSERS_OBJS= \
modules/parsers/nasm/nasm-parser.o \
modules/parsers/nasm/nasm-parse.o \
nasm-token.o \
modules/parsers/gas/gas-parser.o \
modules/parsers/gas/gas-parse-intel.o \
modules/parsers/gas/gas-parse.o \
gas-token.o
YASM_MODULES+=parser_nasm parser_tasm
YASM_MODULES+=parser_gas parser_gnu
MODULES_PREPROCS_NASM_OBJS= \
modules/preprocs/nasm/nasm-eval.o \
modules/preprocs/nasm/nasm-pp.o \
modules/preprocs/nasm/nasm-preproc.o \
modules/preprocs/nasm/nasmlib.o
YASM_MODULES+=preproc_nasm preproc_tasm
MODULES_PREPROCS_RAW_OBJS = \
modules/preprocs/raw/raw-preproc.o
YASM_MODULES+=preproc_raw
MODULES_PREPROCS_CPP_OBJS = \
modules/preprocs/cpp/cpp-preproc.o
YASM_MODULES+=preproc_cpp
MODULES_PREPROCS_GAS_OBJS = \
modules/preprocs/gas/gas-eval.o \
modules/preprocs/gas/gas-preproc.o
YASM_MODULES+=preproc_gas
MODULES_PREPROCS_OBJS = \
$(MODULES_PREPROCS_NASM_OBJS) \
$(MODULES_PREPROCS_RAW_OBJS) \
$(MODULES_PREPROCS_CPP_OBJS) \
$(MODULES_PREPROCS_GAS_OBJS)
MODULES_OBJS = \
$(MODULES_ARCH_OBJS) \
$(MODULES_DBGFMTS_OBJS) \
$(MODULES_LISTFMTS_OBJS) \
$(MODULES_OBJFMTS_OBJS) \
$(MODULES_OPTIMIZERS_OBJS) \
$(MODULES_PARSERS_OBJS) \
$(MODULES_PREPROCS_OBJS)
YASM_OBJS= \
frontends/yasm/yasm.o \
frontends/yasm/yasm-options.o \
$(LIBYASM_OBJS) \
$(MODULES_OBJS)
YTASM_OBJS= \
frontends/tasm/tasm.o \
frontends/tasm/tasm-options.o \
$(LIBYASM_OBJS) \
$(MODULES_OBJS)
VSYASM_OBJS= \
frontends/vsyasm/vsyasm.o \
frontends/yasm/yasm-options.o \
$(LIBYASM_OBJS) \
$(MODULES_OBJS)
genstring: genstring.c
$(BUILDCC) -o $@ $<
license.c: COPYING genstring
./genstring license_msg $@ COPYING
frontends/yasm/yasm.c: license.c
genmacro: tools/genmacro/genmacro.c
$(BUILDCC) -o $@ $<
nasm-version.c: version.mac genmacro
./genmacro $@ nasm_version_mac version.mac
modules/preprocs/nasm/nasm-pp.c: nasm-version.c
nasm-macros.c: modules/parsers/nasm/nasm-std.mac genmacro
./genmacro $@ nasm_standard_mac modules/parsers/nasm/nasm-std.mac
modules/parsers/nasm/nasm-parser.c: nasm-macros.c
win64-nasm.c: modules/objfmts/coff/win64-nasm.mac genmacro
./genmacro $@ win64_nasm_stdmac modules/objfmts/coff/win64-nasm.mac
win64-gas.c: modules/objfmts/coff/win64-gas.mac genmacro
./genmacro $@ win64_gas_stdmac modules/objfmts/coff/win64-gas.mac
modules/objfmts/coff/coff-objfmt.c: win64-nasm.c win64-gas.c
genversion: modules/preprocs/nasm/genversion.c YASM-VERSION.h
$(BUILDCC) -IMkfiles -I. -o $@ $<
version.mac: genversion
./genversion $@
genmodule: libyasm/genmodule.c
$(BUILDCC) -o $@ $<
module.c: libyasm/module.in genmodule
./genmodule libyasm/module.in Mkfiles/Makefile.flat
x86insn_nasm.gperf x86insn_gas.gperf x86insns.c: modules/arch/x86/gen_x86_insn.py
# ignore error in case python is not installed
-python modules/arch/x86/gen_x86_insn.py
x86insn_nasm.c: x86insn_nasm.gperf genperf
./genperf x86insn_nasm.gperf $@
x86insn_gas.c: x86insn_gas.gperf genperf
./genperf x86insn_gas.gperf $@
x86cpu.c: modules/arch/x86/x86cpu.gperf genperf
./genperf modules/arch/x86/x86cpu.gperf $@
x86regtmod.c: modules/arch/x86/x86regtmod.gperf genperf
./genperf modules/arch/x86/x86regtmod.gperf $@
modules/arch/x86/x86id.c: x86insn_nasm.c x86insn_gas.c x86insns.c
lc3bid.c: modules/arch/lc3b/lc3bid.re re2c
./re2c -s -o $@ modules/arch/lc3b/lc3bid.re
gas-token.c: modules/parsers/gas/gas-token.re re2c
./re2c -b -o $@ modules/parsers/gas/gas-token.re
nasm-token.c: modules/parsers/nasm/nasm-token.re re2c
./re2c -b -o $@ modules/parsers/nasm/nasm-token.re
RE2C_SRCS= \
tools/re2c/main.c \
tools/re2c/code.c \
tools/re2c/dfa.c \
tools/re2c/parser.c \
tools/re2c/actions.c \
tools/re2c/scanner.c \
tools/re2c/mbo_getopt.c \
tools/re2c/substr.c \
tools/re2c/translate.c
re2c: $(RE2C_SRCS)
$(BUILDCC) -I. -o re2c $(RE2C_SRCS)
GENPERF_SRCS= \
tools/genperf/genperf.c \
tools/genperf/perfect.c \
libyasm/phash.c \
libyasm/xmalloc.c \
libyasm/xstrdup.c
genperf: $(GENPERF_SRCS)
$(BUILDCC) -I. -o genperf $(GENPERF_SRCS)
yasm: $(YASM_OBJS)
$(CC) -o yasm $(YASM_OBJS)
ytasm: $(YTASM_OBJS)
$(CC) -o ytasm $(YTASM_OBJS)
vsyasm: $(VSYASM_OBJS)
$(CC) -o vsyasm $(VSYASM_OBJS)
.c.o:
$(CC) -c $(CFLAGS) -o $@ $<
$(YASM_OBJS) $(YTASM_OBJS) $(VSYASM_OBJS): YASM-VERSION.h
YASM-VERSION.h: YASM-VERSION-GEN.sh
sh YASM-VERSION-GEN.sh