1# Z88DK Z80 Macro Assembler 2# 3# Copyright (C) Gunther Strube, InterLogic 1993-99 4# Copyright (C) Paulo Custodio, 2011-2019 5# License: The Artistic License 2.0, http://www.perlfoundation.org/artistic_license_2_0 6# Repository: https://github.com/z88dk/z88dk 7# 8# Makefile to generate C files, to be called from the .. directory 9 10# EXESUFFIX is passed when cross-compiling Win32 on Linux 11ifeq ($(OS),Windows_NT) 12 EXESUFFIX := .exe 13else 14 EXESUFFIX ?= 15endif 16 17ASTYLE = astyle \ 18 --mode=c \ 19 --lineend=linux \ 20 --indent=spaces=4 \ 21 --style=ansi \ 22 --break-blocks \ 23 --pad-oper --pad-paren-in --pad-header --unpad-paren \ 24 --align-pointer=name \ 25 --suffix=none 26 27#------------------------------------------------------------------------------ 28# force generation of version with make dev 29#------------------------------------------------------------------------------ 30all:: 31 touch hist.c 32 33#------------------------------------------------------------------------------ 34# ragel parser generator 35#------------------------------------------------------------------------------ 36all:: scan_rules.h 37 38scan_rules.h : scan_rules.rl tokens.h scan_def.h \ 39 parse_ragel.pl dev/Makefile 40 perl parse_ragel.pl scan_rules.rl 41# $(ASTYLE) scan_rules.h -- formatted file too big for debugger (> 65536 lines) 42 43all:: parse_rules.h 44 45dev/cpu/cpu_rules.h : dev/cpu/cpu.pl dev/Makefile 46 perl dev/cpu/cpu.pl 47 48parse_rules.h : parse_rules.rl tokens.h scan_def.h \ 49 parse_ragel.pl dev/Makefile \ 50 dev/cpu/cpu_rules.h 51 perl parse_ragel.pl parse_rules.rl 52 53#------------------------------------------------------------------------------ 54# Generate test scripts using Udo Munk's z80asm as a reference implementation 55#------------------------------------------------------------------------------ 56all:: t/opcodes.t 57 58t/opcodes.t: dev/build_opcodes.pl dev/build_opcodes.asm dev/Makefile 59 $(MAKE) -C dev/z80pack-1.21/z80asm 60 perl dev/build_opcodes.pl 61 62#------------------------------------------------------------------------------ 63# formatting style 64#------------------------------------------------------------------------------ 65astyle: 66 $(ASTYLE) *.c *.h $(LOCAL_LIB)/*.c $(LOCAL_LIB)/*.h 67 68#------------------------------------------------------------------------------ 69# Lemon parser generator 70#------------------------------------------------------------------------------ 71#LEMON := dev/lemon$(EXESUFFIX) 72#LEMON_SRC := dev/lemon.c 73#LEMON_TMPL := dev/lempar.c 74# 75#all:: grammar.c 76# 77#grammar.c grammar.h : $(LEMON) $(LEMON_TMPL) grammar.y dev/Makefile 78# $(LEMON) grammar.y 79# 80#clean:: 81# $(RM) grammar.out $(LEMON) 82# 83#$(LEMON) : $(LEMON_SRC) 84# $(CC) $(CFLAGS) -o $(LEMON) $(LEMON_SRC) 85# 86# 87#------------------------------------------------------------------------------ 88# bison 89#------------------------------------------------------------------------------ 90#parse.c parse.h : parse.y 91# bison parse.y 92 93all:: 94 $(MAKE) 95