# Build ULNAv2-C utilities # # Copyright(c) 2024 Jason Tang # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License version 2 as # published by the Free Software Foundation. FEATURES ?= CFLAGS ?= --std=c99 -Wall -O0 -g $(FEATURES) CXXFLAGS ?= --std=c++11 -Wall -O0 -g $(FEATURES) CROSS_ASFLAGS ?= -g FLEX ?= flex BISON ?= bison bin_PROGRAMS = ulnav2-c-as ulnav2-c-emu C_SOURCES = \ ulnav2-c-as.c ulnav2-c-as.h CXX_SOURCES = \ ulnav2-c-emu.c OBJS = \ ulnav2-c-as.o ulnav2-c-parser.o ulnav2-c-lexer.o \ ulnav2-c-emu.o GENFILES = ulnav2-c-parser.c ulnav2-c-parser.h ulnav2-c-lexer.c all: $(bin_PROGRAMS) ulnav2-c-as: ulnav2-c-as.o ulnav2-c-parser.o ulnav2-c-lexer.o $(CC) -o $@ $^ $(LDFLAGS) ulnav2-c-emu: ulnav2-c-emu.o $(CXX) -o $@ $^ $(LDFLAGS) -lreadline %.o: %.c $(CC) $(CFLAGS) -c -o $@ $< %.o: %.cpp $(CXX) $(CXXFLAGS) -c -o $@ $< %.c: %.y $(BISON) -d -o $@ $< %.c: %.l $(FLEX) -i -o $@ $< indent: for f in $(C_SOURCES); do indent -npro -kr -i8 -ts8 -sob -l80 -ss -ncs -cp1 -il0 $$f; done clean: -rm -f $(bin_PROGRAMS) $(OBJS) $(GENFILES) .PHONY: indent clean .SECONDARY: $(GENFILES)