forked from PrzemekWirkus/sbs2xml-conv
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
77 lines (63 loc) · 1.79 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# Project sbs2xml
#
# About:
# Simple parser which will convert your IBM Rhapsody SBS files to XML format.
#
# Usage:
#
# To compile and build whole project:
# make all
#
# To convert 'myfile.sbs' to simple XML output
# cat myfile.sbs | sbs2xml
# cat myfile.sbs | sbs2xml > myfile.xml
#
# Notes:
# YY_BUF_SIZE is too small to parse bigger SBS files so we need to change it
#
# Versions:
# Version 0.2, February 2014 - added to GitHub.
# Version 0.1, April 2013 - concept developed.
# Uncomment below if you have problem with Make on Windows
#SHELL=C:/Windows/System32/cmd.exe
TARGET=i686-pc-mingw32
CPP=$(TARGET)-g++ -O2 -fpermissive
CC=$(TARGET)-gcc -O2
CXX=$(TARGET)-g++
LD=$(TARGET)-g++ -mconsole -static
YACC=bison -d
LEXX=flex
GAWK=gawk
EXECUTABLE_NAME=sbs2xml
SOURCE = main.cpp
FLEX_OUTPUT = lex.yy.c
YACC_OUTPUT = grama.tab.c
OBJS = $(patsubst %.c, %.o, $(FLEX_OUTPUT)) $(patsubst %.c, %.o, $(YACC_OUTPUT)) $(patsubst %.cpp, %.o, $(SOURCE))
.DEFAULT: all
.PHONY: all flex bison clean
all: ${EXECUTABLE_NAME}.exe
${FLEX_OUTPUT}:
${LEXX} lexer.l
${GAWK} "/#define YY_BUF_SIZE/{gsub(/16384/, \"(1024*1024)\")};{print}" lex.yy.c > lex.yy.c.new
rm -f lex.yy.c
mv lex.yy.c.new lex.yy.c
${YACC_OUTPUT}: ${FLEX_OUTPUT}
$(YACC) grama.y
flex : ${FLEX_OUTPUT}
bison: ${YACC_OUTPUT}
${OBJS}: ${SOURCES} ${FLEX_OUTPUT} ${YACC_OUTPUT}
${CC} ${FLEX_OUTPUT} ${YACC_OUTPUT} -c
${CPP} ${SOURCE} -c
${EXECUTABLE_NAME}.exe : ${OBJS}
${LD} -s ${OBJS} -o ${EXECUTABLE_NAME}.exe
clean:
rm -f *.o
rm -f grama.tab.c grama.tab.h lex.yy.c ${EXECUTABLE_NAME}.exe
help:
@echo sbs2xml Makefile help, 2014
@echo Make options:
@echo make all - build all
@echo make flex - only generate Flex files
@echo make bison - only generate Bison files
@echo make clean - clean all
@echo make help - Print this help