Bump to 4.4
[platform/upstream/make.git] / mk / VMS.mk
1 # GNU -*-Makefile-*- to build GNU make on VMS
2 #
3 # VMS overrides for use with Basic.mk.
4 #
5 # Copyright (C) 2017-2022 Free Software Foundation, Inc.
6 # This file is part of GNU Make.
7 #
8 # GNU Make is free software; you can redistribute it and/or modify it under
9 # the terms of the GNU General Public License as published by the Free Software
10 # Foundation; either version 3 of the License, or (at your option) any later
11 # version.
12 #
13 # GNU Make is distributed in the hope that it will be useful, but WITHOUT ANY
14 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
15 # FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
16 # details.
17 #
18 # You should have received a copy of the GNU General Public License along with
19 # this program.  If not, see <https://www.gnu.org/licenses/>.
20
21 src = [.src]
22 lib = [.lib]
23 SRCDIR = []
24
25 OBJEXT = .obj
26 EXEEXT = .exe
27
28 e =
29 s = $e $e
30 c = ,
31
32 defs = HAVE_CONFIG_H
33
34 ifeq ($(CC),cc)
35 defs += VMS unlink=remove allocated_variable_expand_for_file=alloc_var_expand_for_file
36 else
37 defs += GCC_IS_NATIVE
38 ifeq ($(ARCH),VAX)
39 defs += VAX
40 endif
41 endif
42
43 extra_CPPFLAGS = /define=($(subst $s,$c,$(patsubst %,"%",$(defs))))
44
45 cinclude = /nested=none/include=($(src),$(lib))
46 ifeq ($(CC),cc)
47 cprefix = /prefix=(all,except=(glob,globfree))
48 cwarn = /standard=relaxed/warn=(disable=questcompare)
49 endif
50
51 extra_CFLAGS = $(cinclude)$(cprefix)$(cwarn)
52
53 #extra_LDFLAGS = /deb
54 extra_LDFLAGS =
55
56 # If your system needs extra libraries loaded in, define them here.
57 # System V probably need -lPW for alloca.
58 # if on vax, uncomment the following line
59 #LDLIBS = ,c.opt/opt
60 ifeq ($(CC),cc)
61 #LDLIBS =,sys$$library:vaxcrtl.olb/lib
62 else
63 LDLIBS =,gnu_cc_library:libgcc.olb/lib
64 endif
65
66 # If your system doesn't have alloca, or the one provided is bad,
67 # uncomment this
68 #ALLOCA = $(alloca_SOURCES)
69
70 # If your system doesn't have alloca.h, or the one provided is bad,
71 # uncomment this
72 #BUILT_SOURCES += $(lib)alloca.h
73
74 prog_SOURCES += $(ALLOCA) $(glob_SOURCES) $(vms_SOURCES)
75
76 BUILT_SOURCES += $(lib)fnmatch.h $(lib)glob.h
77
78 COMPILE.cmd = $(CC) $(extra_CFLAGS)$(CFLAGS)/obj=$@ $(extra_CPPFLAGS)$(CPPFLAGS) $1
79
80 LINK.cmd = $(LD)$(extra_LDFLAGS)$(LDFLAGS)/exe=$@ $(subst $s,$c,$1)$(LDLIBS)
81
82 # Don't know how to do this
83 CHECK.cmd =
84
85 MKDIR.cmd = create/dir $1
86 RM.cmd = delete $1
87 CP.cmd = copy $1 $2
88
89 define CLEANSPACE
90         -purge [...]
91         -delete $(PROG);
92         -delete $(src)*.$(OBJEXT);
93 endef
94
95
96 $(OUTDIR)$(src)config.h: $(SRCDIR)$(src)config.h-vms
97         $(call CP.cmd,$<,$@)