File: Makefile

package info (click to toggle)
setools 2.4-3
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 9,680 kB
  • ctags: 8,392
  • sloc: ansic: 96,778; tcl: 21,447; yacc: 4,341; makefile: 874; lex: 304; sh: 164
file content (109 lines) | stat: -rw-r--r-- 2,963 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
#apol tool

APOL_STARTUP_SCRIPT = apol.tcl
APOL_HELP_FILES	= apol_help.txt dta_help.txt iflow_help.txt obj_perms_help.txt 
APOL_PERM_MAPS  = perm_maps/apol_perm_mapping_ver*
APOL_DFLT_PMAP  = apol_perm_mapping_ver18

# The modules must each be listed here.
ANALYSIS-MODULES = dta_module.tcl dirflow_module.tcl fulflow_module.tcl \
                   relabel_module.tcl types_relation_module.tcl

TCL-FILES	= head.tcl tmp.tcl
TCL-STRIP-FILES = types_tab.tcl terules_tab.tcl roles_tab.tcl rbac_tab.tcl \
		  users_tab.tcl initial_sids_tab.tcl file_contexts_tab.tcl \
		  cond_bools_tab.tcl cond_rules_tab.tcl classes_perms_tab.tcl \
		  policyconf.tcl perms_map.tcl analysis_tab.tcl \
		  range_dialog.tcl level_dialog.tcl \
		  range_trans.tcl mls_tab.tcl \
		  netcontexts_tab.tcl context_dialog.tcl context_selector.tcl \
		  fscontexts_tab.tcl \
		  common_widgets.tcl range_selector.tcl \
		  $(ANALYSIS-MODULES) top.tcl

ifeq ($(DYNAMIC), 0)
	LIBAPOL		= ../libapol/libapol-tcl.a ../libapol/libapol.a
	
	ifeq ($(USE_LIBSEFS), 1)
	LIBSEFS		= ../libsefs/libsefs.a
	else
	LIBSEFS = 
	endif
else
	LIBAPOL		= ../libapol/libapol.so.$(shell cat ../libapol/VERSION) ../libapol/libapol-tcl.a
	
	ifeq ($(USE_LIBSEFS), 1)
	LIBSEFS		= ../libsefs/libsefs.so.$(shell cat ../libsefs/VERSION)
	else
	LIBSEFS = 
	endif
endif

GUI-OBJ		= apol_gui.o $(LIBAPOL) $(LIBSEFS)
CFLAGS          += -DSTARTUP_SCRIPT='"$(APOL_STARTUP_SCRIPT)"'

# apol is optionally linked to libselinux. The LIBSELINUX variable 
# is set in the top-level Makefile.
all: libapol libapol-tcl apol

apol: $(GUI-OBJ) apol.tcl
	$(CC) $(TCL_LIBINC) -o $@ $(LDFLAGS) $(GUI-OBJ) $(TCL_LIBS) $(LIBSELINUX)


apol.tcl: $(TCL-FILES)
	cat $(TCL-FILES) | \
	sed -e 's/APOL_GUI_VERSION/$(shell cat VERSION)/g' | \
	sed -e 's|APOL_INSTALL_DIR|$(INSTALL_LIBDIR)|g' > $@ 

tmp.tcl: $(TCL-STRIP-FILES)
	cat $(TCL-STRIP-FILES) > $@
	# compact it by removing comments and empty lines
	@perl -p -i -e 's/^\s*(\#[^!]*){0,1}$$//s' $@

libpol:
	$(MAKE) -C .. libapol

libapol-tcl:
	$(MAKE) -C .. libapol-tcl

libsefs:
	$(MAKE) -C .. libsefs

../libapol/libapol.a: 
	$(MAKE) -C .. libapol

../libapol/libapol-tcl.a:
	$(MAKE) -C .. libapol-tcl

%.o:  %.c 
	$(CC) $(CFLAGS) -c $<

%.tcl: 
# do nothing

$(LIBSEFS):
	$(MAKE) -C .. libsefs

install: apol apol.tcl
	install -m 755 apol $(BINDIR)
	@if [ -n $(INSTALL_LIBDIR) ]; then \
		for file in $(TCL-FILES); do \
			if [ -f $(INSTALL_LIBDIR)/$$file ]; then \
				mv $(INSTALL_LIBDIR)/$$file $(INSTALL_LIBDIR)/$$file.old; \
			fi \
		done \
	fi
	install -m 644 apol.tcl $(APOL_PERM_MAPS) $(INSTALL_LIBDIR)
	install -m 644 $(APOL_HELP_FILES) $(INSTALL_HELPDIR) 
	cd $(INSTALL_LIBDIR); ln -sf $(APOL_DFLT_PMAP) apol_perm_mapping
	test -d $(MANDIR)/man1 || install -m 755 -d $(MANDIR)/man1
	install -m 644 ../man/apol.1 $(MANDIR)/man1

clean:
	rm -f *.o  core apol *~ apol.tcl tmp.tcl

bare:
	rm -f *.o  core* apol *~ apol.tcl tmp.tcl

.PHONY: clean bare libapol libapol-tcl libsefs