1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/libe2access/host/Makefile Tue Dec 28 01:37:59 2021 +0100
1.3 @@ -0,0 +1,88 @@
1.4 +# Makefile - Build the filesystem access programs
1.5 +#
1.6 +# Copyright (C) 2019, 2021 Paul Boddie <paul@boddie.org.uk>
1.7 +#
1.8 +# This program is free software: you can redistribute it and/or modify
1.9 +# it under the terms of the GNU General Public License as published by
1.10 +# the Free Software Foundation, either version 3 of the License, or
1.11 +# (at your option) any later version.
1.12 +#
1.13 +# This program is distributed in the hope that it will be useful,
1.14 +# but WITHOUT ANY WARRANTY; without even the implied warranty of
1.15 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1.16 +# GNU General Public License for more details.
1.17 +#
1.18 +# You should have received a copy of the GNU General Public License
1.19 +# along with this program. If not, see <http://www.gnu.org/licenses/>.
1.20 +
1.21 +# Paths to library sources.
1.22 +
1.23 +INC = ../include/e2access
1.24 +SRC = ../lib/src
1.25 +
1.26 +# Tool definitions.
1.27 +
1.28 +RANLIB = ranlib
1.29 +
1.30 +# Compilation and linking flags.
1.31 +
1.32 +CFLAGS = -I$(INC) # -g
1.33 +LDFLAGS = -lext2fs -L. -le2access # -lcom_err
1.34 +
1.35 +# Output programs and libraries.
1.36 +
1.37 +E2ACCESS = e2access
1.38 +LIBE2ACCESS = libe2access.a
1.39 +LIBE2ACCESS_SHARED = libe2access.so
1.40 +
1.41 +TEST_LISTING = test_listing
1.42 +TEST_REMOVE = test_remove
1.43 +
1.44 +TARGETS = $(E2ACCESS) $(LIBE2ACCESS) $(LIBE2ACCESS_SHARED) $(TEST_LISTING) $(TEST_REMOVE)
1.45 +
1.46 +# Sources and objects.
1.47 +
1.48 +E2ACCESS_SRC = e2access.c file.c
1.49 +E2ACCESS_OBJ = $(E2ACCESS_SRC:.c=.o)
1.50 +
1.51 +TEST_LISTING_SRC = test_listing.c
1.52 +TEST_LISTING_OBJ = $(TEST_LISTING_SRC:.c=.o)
1.53 +
1.54 +TEST_REMOVE_SRC = test_remove.c
1.55 +TEST_REMOVE_OBJ = $(TEST_REMOVE_SRC:.c=.o)
1.56 +
1.57 +LIBE2ACCESS_SRC = $(foreach FILE,format.c image.c path.c,$(SRC)/$(FILE))
1.58 +LIBE2ACCESS_OBJ = $(LIBE2ACCESS_SRC:.c=.o)
1.59 +
1.60 +ALL_OBJ = $(E2ACCESS_OBJ) $(LIBE2ACCESS_OBJ) $(TEST_LISTING_OBJ) $(TEST_REMOVE_OBJ)
1.61 +
1.62 +# Rules.
1.63 +
1.64 +.PHONY: all clean distclean
1.65 +
1.66 +all: $(TARGETS)
1.67 +
1.68 +clean:
1.69 + rm -f $(ALL_OBJ) $(TARGETS)
1.70 +
1.71 +distclean: clean
1.72 + echo "Nothing else to clean."
1.73 +
1.74 +$(E2ACCESS): $(E2ACCESS_OBJ) $(LIBE2ACCESS_SHARED)
1.75 + $(CC) $(LDFLAGS) $(E2ACCESS_OBJ) -o $@
1.76 +
1.77 +$(LIBE2ACCESS): $(LIBE2ACCESS_OBJ)
1.78 + $(AR) rc $@ $(LIBE2ACCESS_OBJ)
1.79 + $(RANLIB) $@
1.80 +
1.81 +$(LIBE2ACCESS_SHARED): $(LIBE2ACCESS) $(LIBE2ACCESS_OBJ)
1.82 + $(LD) -shared $(LIBE2ACCESS_OBJ) -o $(LIBE2ACCESS_SHARED)
1.83 +
1.84 +$(TEST_LISTING): $(TEST_LISTING_OBJ) $(LIBE2ACCESS_SHARED)
1.85 + $(CC) $(LDFLAGS) $(TEST_LISTING_OBJ) -o $@
1.86 +
1.87 +$(TEST_REMOVE): $(TEST_REMOVE_OBJ) $(LIBE2ACCESS_SHARED)
1.88 + $(CC) $(LDFLAGS) $(TEST_REMOVE_OBJ) -o $@
1.89 +
1.90 +.c.o:
1.91 + $(CC) -c $(CFLAGS) $< -o $@