xref: /aosp_15_r20/external/selinux/mcstrans/utils/Makefile (revision 2d543d20722ada2425b5bdab9d0d1d29470e7bba)
1*2d543d20SAndroid Build Coastguard Worker# Installation directories.
2*2d543d20SAndroid Build Coastguard WorkerPREFIX ?= /usr
3*2d543d20SAndroid Build Coastguard WorkerSBINDIR ?= $(PREFIX)/sbin
4*2d543d20SAndroid Build Coastguard Worker
5*2d543d20SAndroid Build Coastguard WorkerTARGETS=transcon untranscon
6*2d543d20SAndroid Build Coastguard Worker
7*2d543d20SAndroid Build Coastguard Worker# If no specific libsepol.a is specified, fall back on LDFLAGS search path
8*2d543d20SAndroid Build Coastguard Worker# Otherwise, as $(LIBSEPOLA) already appears in the dependencies, there
9*2d543d20SAndroid Build Coastguard Worker# is no need to define a value for LDLIBS_LIBSEPOLA
10*2d543d20SAndroid Build Coastguard Workerifeq ($(LIBSEPOLA),)
11*2d543d20SAndroid Build Coastguard Worker        LDLIBS_LIBSEPOLA := -l:libsepol.a
12*2d543d20SAndroid Build Coastguard Workerendif
13*2d543d20SAndroid Build Coastguard Worker
14*2d543d20SAndroid Build Coastguard Workerall: $(TARGETS)
15*2d543d20SAndroid Build Coastguard Worker
16*2d543d20SAndroid Build Coastguard Workertranscon: transcon.o ../src/mcstrans.o ../src/mls_level.o $(LIBSEPOLA)
17*2d543d20SAndroid Build Coastguard Worker	$(CC) $(LDFLAGS) -o $@ $^ $(PCRE_LDLIBS) -lselinux $(LDLIBS_LIBSEPOLA)
18*2d543d20SAndroid Build Coastguard Worker
19*2d543d20SAndroid Build Coastguard Workeruntranscon: untranscon.o ../src/mcstrans.o ../src/mls_level.o $(LIBSEPOLA)
20*2d543d20SAndroid Build Coastguard Worker	$(CC) $(LDFLAGS) -o $@ $^ $(PCRE_LDLIBS) -lselinux $(LDLIBS_LIBSEPOLA)
21*2d543d20SAndroid Build Coastguard Worker
22*2d543d20SAndroid Build Coastguard Worker%.o:  %.c
23*2d543d20SAndroid Build Coastguard Worker	$(CC) $(CPPFLAGS) $(CFLAGS) $(PCRE_CFLAGS) -D_GNU_SOURCE -I../src -fPIE -c -o $@ $<
24*2d543d20SAndroid Build Coastguard Worker
25*2d543d20SAndroid Build Coastguard Workerinstall: all
26*2d543d20SAndroid Build Coastguard Worker	-mkdir -p $(DESTDIR)$(SBINDIR)
27*2d543d20SAndroid Build Coastguard Worker	install -m 755 $(TARGETS) $(DESTDIR)$(SBINDIR)
28*2d543d20SAndroid Build Coastguard Worker
29*2d543d20SAndroid Build Coastguard Workertest:
30*2d543d20SAndroid Build Coastguard Worker	./mlstrans-test-runner.py ../test/*.test
31*2d543d20SAndroid Build Coastguard Worker
32*2d543d20SAndroid Build Coastguard Workerclean:
33*2d543d20SAndroid Build Coastguard Worker	rm -f $(TARGETS) *.o *~ \#*
34*2d543d20SAndroid Build Coastguard Worker
35*2d543d20SAndroid Build Coastguard Workerrelabel:
36*2d543d20SAndroid Build Coastguard Worker
37