Debian Codegraph @

vmdk/Makefile

raw symbols SCIP
1 # ================================================================================
2 # Copyright (c) 2014-2023 VMware, Inc. All Rights Reserved.
3 #
4 # Licensed under the Apache License, Version 2.0 (the “License”); you may not
5 # use this file except in compliance with the License. You may obtain a copy of
6 # the License at:
7 #
8 # http://www.apache.org/licenses/LICENSE-2.0
9 #
10 # Unless required by applicable law or agreed to in writing, software distributed
11 # under the License is distributed on an “AS IS” BASIS, without warranties or
12 # conditions of any kind, EITHER EXPRESS OR IMPLIED. See the License for the
13 # specific language governing permissions and limitations under the License.
14 # ================================================================================
15
16 SRC := flat.c sparse.c mkdisk.c
17 SRC_FUSE := sparse.c vmdk-fuse.c
18
19 OUTPUTDIR := ../build/vmdk
20 EXE := $(OUTPUTDIR)/vmdk-convert
21 EXE_FUSE := $(OUTPUTDIR)/vmdk-fuse
22
23 PREFIX ?= /usr
24
25 CC := gcc
26 CFLAGS := -W -Wall -O2 -g $(CFLAGS)
27 LDFLAGS := -g -lz $(LDFLAGS)
28 LDFLAGS_FUSE := $(LDFLAGS) $$(pkg-config fuse3 --libs)
29
30 OBJS := $(addprefix $(OUTPUTDIR)/, $(SRC:%.c=%.o))
31 OBJS_FUSE := $(addprefix $(OUTPUTDIR)/, $(SRC_FUSE:%.c=%.o))
32
33 default: all
34
35 fuse: all $(EXE_FUSE)
36
37 all: $(EXE)
38
39 $(EXE): $(OBJS) $(OUTPUTDIR)
40 $(CC) -o $@ $(OBJS) $(LDFLAGS)
41
42 $(EXE_FUSE): $(OBJS_FUSE) $(OUTPUTDIR)
43 $(CC) -o $@ $(OBJS_FUSE) $(LDFLAGS_FUSE)
44
45 $(OUTPUTDIR)/%.o: %.c | $(OUTPUTDIR)
46 $(CC) $(CFLAGS) -c -o $@ $<
47
48 $(OUTPUTDIR)/vmdk-fuse.o: vmdk-fuse.c | $(OUTPUTDIR)
49 $(CC) $(CFLAGS) $$(pkg-config fuse3 --cflags) -c -o $@ $<
50
51 $(OUTPUTDIR):
52 mkdir -p $(OUTPUTDIR)
53
54 $(addprefix $(OUTPUTDIR)/,mkdisk.o flat.o sparse.o): diskinfo.h
55
56 $(addprefix $(OUTPUTDIR)/,sparse.o): vmware_vmdk.h
57
58 check:
59 sparse -Wsparse-all -I/usr/include/x86_64-linux-gnu $(SRC)
60
61 install:
62 mkdir -p $(DESTDIR)/$(PREFIX)/bin && cp $(EXE) $(DESTDIR)/$(PREFIX)/bin/
63
64 install-fuse:
65 mkdir -p $(DESTDIR)/$(PREFIX)/bin && cp $(EXE_FUSE) $(DESTDIR)/$(PREFIX)/bin/
66
67 clean:
68 rm -rf $(OUTPUTDIR)