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
)
43 -fno-strict-aliasing \
48 CFLAGS
.31= $(CFLAGS.ALL
) $(CPPFLAGS
.31)
49 CFLAGS
.64= $(CFLAGS.ALL
) $(CPPFLAGS
.64)
52 LINKER_SCRIPT
= linker.script
53 LDFLAGS.ALL
= -T
$(LINKER_SCRIPT
)
54 LDFLAGS
.31= $(LDFLAGS.ALL
) -melf_s390
55 LDFLAGS
.64= $(LDFLAGS.ALL
) -melf64_s390
64 GENSRCS
:=${Y_SRCS
:C
/\.y
$/.c
/} \
66 GENHDRS
:=${Y_SRCS
:C
/\.y
$/.h
/} \
69 OBJS
:=${C_SRCS
:%.c
=%.o
} \
77 rm -f
$(BIN
) $(BIN
).raw
82 rm -f
$(OBJS
) $(CLEANSRCS
)
83 .if
!empty
(GENSRCS
) ||
!empty
(GENHDRS
)
84 rm -f
$(GENSRCS
) $(GENHDRS
)
89 $(BIN
): $(OBJS
) $(LINKER_SCRIPT
)
90 $(LD
) $(LDFLAGS.
$(BITS
)) -o
$(BIN
) $(OBJS
) $(LD_ADD
)
93 $(OBJCOPY
) -O binary
${SECTIONS
:%=-j
%} ${.ALLSRC
} ${.TARGET
}
101 $(AR
) cr
${.TARGET
} ${.ALLSRC
}
106 # remove built-in .[yl] -> .o rules
111 $(CC
) $(CFLAGS.
$(BITS
)) -c
-o
${.TARGET
} ${.IMPSRC
}
114 $(CC
) $(CFLAGS.
$(BITS
)) -D_ASM
-x assembler-with-cpp
-c
-o
${.TARGET
} ${.IMPSRC
}
117 cd
${.IMPSRC
:H
} && $(SRCTOP
)/build
/byacc
/yacc \
119 -d
-P
-p
${.IMPSRC
:T
:R
:S
/grammar
//} \
120 -o
${.IMPSRC
:T
:R
}.c
${.IMPSRC
:T
}
123 cd
${.IMPSRC
:H
} && $(SRCTOP
)/build
/re2c
/re2c \
124 -o
${.IMPSRC
:T
:R
}.c
${.IMPSRC
:T
}