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