comparison direct/python/Makefile @ 296:9faa67601a8b

Change from SWIG to ctypes... much easier
author charles <charles>
date Fri, 09 Oct 2009 06:12:26 +0000
parents 894264c411db
children 84b985d09f3c
comparison
equal deleted inserted replaced
295:894264c411db 296:9faa67601a8b
12 # it under the terms of the GNU General Public License version 2 as 12 # it under the terms of the GNU General Public License version 2 as
13 # published by the Free Software Foundation. 13 # published by the Free Software Foundation.
14 # 14 #
15 # NB Warning this Makefile does not include header dependencies. 15 # NB Warning this Makefile does not include header dependencies.
16 # 16 #
17 # $Id: Makefile,v 1.2 2009-10-08 23:11:12 charles Exp $ 17 # $Id: Makefile,v 1.3 2009-10-09 06:12:26 charles Exp $
18 18
19 #EXTRA_COMPILE_FLAGS = -DYAFFS_IGNORE_TAGS_ECC 19 #EXTRA_COMPILE_FLAGS = -DYAFFS_IGNORE_TAGS_ECC
20 20
21 CFLAGS = -DCONFIG_YAFFS_DIRECT -DCONFIG_YAFFS_SHORT_NAMES_IN_RAM -DCONFIG_YAFFS_YAFFS2 21 CFLAGS = -DCONFIG_YAFFS_DIRECT -DCONFIG_YAFFS_SHORT_NAMES_IN_RAM -DCONFIG_YAFFS_YAFFS2
22 CFLAGS += -DCONFIG_YAFFS_PROVIDE_DEFS -DCONFIG_YAFFSFS_PROVIDE_VALUES -DNO_Y_INLINE 22 CFLAGS += -DCONFIG_YAFFS_PROVIDE_DEFS -DCONFIG_YAFFSFS_PROVIDE_VALUES -DNO_Y_INLINE
34 yaffs_tagscompat.o yaffs_packedtags2.o yaffs_tagsvalidity.o yaffs_nand.o \ 34 yaffs_tagscompat.o yaffs_packedtags2.o yaffs_tagsvalidity.o yaffs_nand.o \
35 yaffs_checkptrw.o yaffs_qsort.o\ 35 yaffs_checkptrw.o yaffs_qsort.o\
36 yaffs_norif1.o ynorsim.o 36 yaffs_norif1.o ynorsim.o
37 37
38 38
39 YAFFSTESTOBJS = $(COMMONTESTOBJS) yaffs_wrap.o yaffs_swig_helper.o 39 YAFFSSWIGOBJS = $(COMMONTESTOBJS) yaffs_wrap.o yaffs_python_helper.o
40 YAFFSLIBOBJS = $(COMMONTESTOBJS) yaffs_python_helper.o
40 41
41 42
42 ALLOBJS = $(sort $(YAFFSTESTOBJS))
43 43
44 YAFFSSYMLINKS = devextras.h yaffs_ecc.c yaffs_ecc.h yaffs_guts.c yaffs_guts.h yaffsinterface.h yportenv.h yaffs_tagscompat.c yaffs_tagscompat.h \ 44 YAFFSSYMLINKS = devextras.h yaffs_ecc.c yaffs_ecc.h yaffs_guts.c yaffs_guts.h yaffsinterface.h yportenv.h yaffs_tagscompat.c yaffs_tagscompat.h \
45 yaffs_packedtags1.c yaffs_packedtags1.h yaffs_packedtags2.c yaffs_packedtags2.h yaffs_nandemul2k.h \ 45 yaffs_packedtags1.c yaffs_packedtags1.h yaffs_packedtags2.c yaffs_packedtags2.h yaffs_nandemul2k.h \
46 yaffs_nand.c yaffs_nand.h yaffs_getblockinfo.h \ 46 yaffs_nand.c yaffs_nand.h yaffs_getblockinfo.h \
47 yaffs_tagsvalidity.c yaffs_tagsvalidity.h yaffs_checkptrw.h yaffs_checkptrw.c \ 47 yaffs_tagsvalidity.c yaffs_tagsvalidity.h yaffs_checkptrw.h yaffs_checkptrw.c \
54 yaffs_nandif.c yaffs_nandif.h 54 yaffs_nandif.c yaffs_nandif.h
55 55
56 56
57 SYMLINKS = $(YAFFSSYMLINKS) $(YAFFSDIRECTSYMLINKS) 57 SYMLINKS = $(YAFFSSYMLINKS) $(YAFFSDIRECTSYMLINKS)
58 58
59 all: _yaffs.so 59 all: _yaffs.so libyaffsfs.so
60 60
61 yaffs_wrap.c: yaffs.i yaffsfs_for_swig.h 61 yaffs_wrap.c: yaffs.i yaffsfs_for_swig.h
62 swig -python yaffs.i 62 swig -python yaffs.i
63 63
64 yaffsfs_for_swig.h: yaffsfs.h 64 yaffsfs_for_swig.h: yaffsfs.h
69 sed -e "s/loff_t/long long/g" | \ 69 sed -e "s/loff_t/long long/g" | \
70 sed -e "s/off_t/long/g" | \ 70 sed -e "s/off_t/long/g" | \
71 sed -e "s/struct yaffs_stat/struct yaffs_stat_struct/g" \ 71 sed -e "s/struct yaffs_stat/struct yaffs_stat_struct/g" \
72 > $@ 72 > $@
73 73
74 $(ALLOBJS): %.o: %.c 74 $(YAFFSLIBOBJS): %.o: %.c
75 gcc -c $(CFLAGS) -o $@ $<
76
77 yaffs_wrap.o: %.o: %.c
75 gcc -c $(CFLAGS) -I/usr/include/python2.6/ -o $@ $< 78 gcc -c $(CFLAGS) -I/usr/include/python2.6/ -o $@ $<
76 79
77 80
78 $(YAFFSSYMLINKS): 81 $(YAFFSSYMLINKS):
79 ln -s ../../$@ $@ 82 ln -s ../../$@ $@
81 $(YAFFSDIRECTSYMLINKS): 84 $(YAFFSDIRECTSYMLINKS):
82 ln -s ../$@ $@ 85 ln -s ../$@ $@
83 86
84 87
85 88
86 _yaffs.so: $(SYMLINKS) yaffs_wrap.c $(ALLOBJS) 89 _yaffs.so: $(SYMLINKS) yaffs_wrap.c $(YAFFSSWIGOBJS)
87 gcc -shared $(ALLOBJS) -o $@ 90 gcc -shared $(YAFFSSWIGOBJS) -o $@
91
92 libyaffsfs.so: $(SYMLINKS) $(YAFFSLIBOBJS)
93 gcc -shared $(YAFFSLIBOBJS) -o $@
88 94
89 95
90 96
91 97
92 clean: 98 clean:
93 rm -f _yaffs.so yaffs.py yaffs.pyc yaffs_wrap.c $(ALLOBJS) core $(YAFFSSYMLINKS) $(YAFFSDIRECTSYMLINKS) 99 rm -f _yaffs.so yaffs.py yaffs.pyc yaffs_wrap.c $(YAFFSLIBOBJS) yaffs_wrap.o core $(YAFFSSYMLINKS) $(YAFFSDIRECTSYMLINKS)
94 rm -f *.c.* 100 rm -f *.c.*
95 rm -f yaffsfs_for_swig.h 101 rm -f yaffsfs_for_swig.h
102 rm -f libyaffsfs.so
103