2 # Copyright (c) 2019 Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
4 # Permission is hereby granted, free of charge, to any person obtaining a copy
5 # of this software and associated documentation files (the "Software"), to deal
6 # in the Software without restriction, including without limitation the rights
7 # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 # copies of the Software, and to permit persons to whom the Software is
9 # furnished to do so, subject to the following conditions:
11 # The above copyright notice and this permission notice shall be included in
12 # all copies or substantial portions of the Software.
14 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
27 OBJCOPY
= s390x-linux-objcopy
28 SECTIONS?
= .text .data .rodata .rodata.str1.2
31 CPPFLAGS.ALL
= -DVERSION
="\"$(HVF_VERSION)\"" \
32 -I
$(SRCTOP
)/include \
33 -include $(SRCTOP
)/include/types.h \
35 CPPFLAGS
.31= $(CPPFLAGS.ALL
)
36 CPPFLAGS
.64= $(CPPFLAGS.ALL
)
44 -fno-strict-aliasing \
49 CFLAGS
.31= $(CFLAGS.ALL
) $(CPPFLAGS
.31)
50 CFLAGS
.64= $(CFLAGS.ALL
) $(CPPFLAGS
.64)
53 LINKER_SCRIPT
= linker.script
54 LDFLAGS.ALL
= -T
$(LINKER_SCRIPT
)
55 LDFLAGS
.31= $(LDFLAGS.ALL
) -melf_s390
56 LDFLAGS
.64= $(LDFLAGS.ALL
) -melf64_s390
65 GENSRCS
:=${Y_SRCS
:C
/\.y
$/.c
/} \
67 GENHDRS
:=${Y_SRCS
:C
/\.y
$/.h
/} \
70 OBJS
:=${C_SRCS
:%.c
=%.o
} \
78 rm -f
$(BIN
) $(BIN
).raw
83 rm -f
$(OBJS
) $(CLEANSRCS
)
84 .if
!empty
(GENSRCS
) ||
!empty
(GENHDRS
)
85 rm -f
$(GENSRCS
) $(GENHDRS
)
90 $(BIN
): $(OBJS
) $(LINKER_SCRIPT
)
91 $(LD
) $(LDFLAGS.
$(BITS
)) -o
$(BIN
) $(OBJS
) $(LD_ADD
)
94 $(OBJCOPY
) -O binary
${SECTIONS
:%=-j
%} ${.ALLSRC
} ${.TARGET
}
102 $(AR
) cr
${.TARGET
} ${.ALLSRC
}
107 # remove built-in .[yl] -> .o rules
112 $(CC
) $(CFLAGS.
$(BITS
)) -c
-o
${.TARGET
} ${.IMPSRC
}
115 $(CC
) $(CFLAGS.
$(BITS
)) -D_ASM
-x assembler-with-cpp
-c
-o
${.TARGET
} ${.IMPSRC
}
118 cd
${.IMPSRC
:H
} && $(SRCTOP
)/build
/byacc
/yacc \
120 -d
-P
-p
${.IMPSRC
:T
:R
:S
/grammar
//} \
121 -o
${.IMPSRC
:T
:R
}.c
${.IMPSRC
:T
}
124 cd
${.IMPSRC
:H
} && $(SRCTOP
)/build
/re2c
/re2c \
125 -o
${.IMPSRC
:T
:R
}.c
${.IMPSRC
:T
}