summaryrefslogtreecommitdiffstats
path: root/isys/Makefile
blob: 7b38cefc6fa522f6881f49fc5bfc6560efb9bf44 (plain)
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
include ../Makefile.inc

CFLAGS +=  -I$(PYTHONINCLUDE) -I.. -DHAVE_NFS

OBJECTS = nfsmount.o nfsmount_clnt.o nfsmount_xdr.o imount.o \
          smp.o devnodes.o cpio.o uncpio.o dasd.o \
          lang.o isofs.o dns.o linkdetect.o vio.o \
          ethtool.o wireless.o eddsupport.o nl.o str.o auditd.o
SOBJECTS = $(patsubst %.o,%.lo,$(OBJECTS))
SOURCES = $(patsubst %.o,%.c,$(OBJECTS)) isys.c
LOADLIBES = -lresolv -lpci -lpopt -lext2fs -lz -lkudzu -lpci -ldevmapper
LOADLIBES += $(SELINUXLIBES)
ifeq ($(USESELINUX),1)
LOADLIBES += -laudit
endif
PYMODULES = _isys.so
SUBDIRS = 

# glib
LOADLIBES += $(shell pkg-config --libs glib-2.0)
CFLAGS    += $(shell pkg-config --cflags glib-2.0)

# libdhcp
LOADLIBES += $(shell pkg-config --libs libdhcp)
CFLAGS += $(shell pkg-config --cflags libdhcp)

GENERATED = nfs_mountversion.h

ifeq ($(ARCH),sparc)
PYMODULES += _silo.so
SOURCES += silo.c
endif

ifeq ($(ARCH),ppc)
OBJECTS += minifind.o
SOURCES += minifind.c
endif

ifeq (.depend,$(wildcard .depend))
TARGET=all
else
TARGET=depend all
endif

everything: $(TARGET)

all: subdirs $(PYMODULES) libisys.a

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

_isys.so: isys.lo $(SOBJECTS)
	gcc -shared -g -fPIC -o $@ isys.lo $(SOBJECTS) $(LOADLIBES) $(LDFLAGS)

_silo.so: silo.c
	gcc -shared $(CFLAGS) -fpic -o $@ silo.c ../balkan/libbalkan.a

libisys.a: libisys.a($(OBJECTS))

filtertest: filtertest.o libisys.a

clean:
	rm -f *.o *.so *.lo *.a *.pyc $(TARGET) $(SOBJECTS)
	rm -f $(OBJECTS) $(GENERATED)
	rm -f .depend
	rm -f nl
	for d in $(SUBDIRS); do make -C $$d clean; done

install: all
	install -s $(PYMODULES) $(DESTDIR)/$(PYTHONLIBDIR)
	install isys.py $(DESTDIR)/$(PYTHONLIBDIR)

subdirs:
	for d in $(SUBDIRS); do make -C $$d; done

nfsmount.o: nfs_mountversion.h

nfsmount.lo: nfs_mountversion.h

nfsmount.do: nfs_mountversion.h

nfs_mountversion.h: /usr/include/linux/nfs_mount.h
	grep NFS_MOUNT_VERSION $< | sed -e 's/NFS/KERNEL_NFS/' > $@

nltest: str.o nl.c nl.h
	$(CC) -c $(CFLAGS) -DTESTING nl.c -o nl.o
	$(CC) -DTESTING nl.o -o nl $(LOADLIBES) str.o

depend: nfs_mountversion.h
	$(CPP) -M $(CFLAGS) $(SOURCES) > .depend

ifeq (.depend,$(wildcard .depend))
include .depend
endif