Home | History | Annotate | Download | only in src
      1 ARCH = $(shell uname -i)
      2 ifeq "$(ARCH)" "x86_64"
      3 	# In case of 64 bit system, use these lines
      4 	LIBDIR=/usr/lib64
      5 else 
      6 ifeq "$(ARCH)" "i686"
      7 	# In case of 32 bit system, use these lines
      8 	LIBDIR=/usr/lib
      9 else
     10 ifeq "$(ARCH)" "i386"
     11 	# In case of 32 bit system, use these lines
     12 	LIBDIR=/usr/lib
     13 endif
     14 endif
     15 endif
     16 # Installation directories.
     17 PREFIX  ?= $(DESTDIR)/usr
     18 SBINDIR ?= $(DESTDIR)/sbin
     19 INITDIR ?= $(DESTDIR)/etc/rc.d/init.d
     20 SYSTEMDDIR ?= $(DESTDIR)/usr/lib/systemd
     21 
     22 PROG_SRC=mcstrans.c  mcscolor.c  mcstransd.c  mls_level.c
     23 PROG_OBJS= $(patsubst %.c,%.o,$(PROG_SRC))
     24 PROG=mcstransd
     25 INITSCRIPT=mcstrans
     26 CFLAGS ?= -Wall -W -Wundef -Wmissing-noreturn -Wmissing-format-attribute
     27 override CFLAGS += -I../include -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64
     28 
     29 all: $(PROG)
     30 
     31 $(PROG): $(PROG_OBJS)
     32 	$(CC) $(LDFLAGS) -pie -o $@ $^ -lselinux -lcap -lpcre $(LIBDIR)/libsepol.a
     33 
     34 %.o:  %.c 
     35 	$(CC) $(CFLAGS) -fPIE -c -o $@ $<
     36 
     37 install: all
     38 	test -d $(SBINDIR) || install -m 755 -d $(SBINDIR)
     39 	install -m 755 $(PROG) $(SBINDIR)
     40 	test -d $(INITDIR) || install -m 755 -d $(INITDIR)
     41 	install -m 755 $(INITSCRIPT).init $(INITDIR)/$(INITSCRIPT)
     42 	test -d $(SYSTEMDDIR)/system || install -m 755 -d $(SYSTEMDDIR)/system
     43 	install -m 644 mcstrans.service $(SYSTEMDDIR)/system/
     44 
     45 clean: 
     46 	-rm -f $(OBJS) $(LOBJS) $(TARGET) $(PROG) $(PROG_OBJS) *~ \#*
     47 
     48