summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornima <nima@abc39116-655e-4be6-ad55-d661dc543056>2008-06-30 14:14:46 +0000
committernima <nima@abc39116-655e-4be6-ad55-d661dc543056>2008-06-30 14:14:46 +0000
commit4f5bfc68e416a7d1e6264e43278fe9b9df684eed (patch)
tree7d91957dac6645623c3e060771e83cc5dce617cf
parente7d6d472c21aa80c28be01c0d6dcbfd250d57a25 (diff)
downloadpython-dmidecode-4f5bfc68e416a7d1e6264e43278fe9b9df684eed.tar.gz
python-dmidecode-4f5bfc68e416a7d1e6264e43278fe9b9df684eed.tar.xz
python-dmidecode-4f5bfc68e416a7d1e6264e43278fe9b9df684eed.zip
Split out the module header into its own file.
Cleaned up Makefile a little. git-svn-id: svn://svn.autonomy.net.au/python-dmidecode@2 abc39116-655e-4be6-ad55-d661dc543056
-rw-r--r--Makefile20
-rw-r--r--dmidecodemodule.c36
-rw-r--r--dmidecodemodule.h37
3 files changed, 48 insertions, 45 deletions
diff --git a/Makefile b/Makefile
index 29d4238..ac1b870 100644
--- a/Makefile
+++ b/Makefile
@@ -34,7 +34,7 @@ INSTALL_DIR := $(INSTALL) -m 755 -d
INSTALL_PROGRAM := $(INSTALL) -m 755
RM := rm -f
-PROGRAMS := go
+PROGRAMS := dmidecode
PROGRAMS += $(shell test `uname -m 2>/dev/null` != ia64 && echo biosdecode ownership vpddecode)
# BSD make doesn't understand the $(shell) syntax above, it wants the !=
# syntax below. GNU make ignores the line below so in the end both BSD
@@ -50,21 +50,21 @@ all : $(PROGRAMS)
ldd /usr/lib/python2.4/site-packages/dmidecode.so
python -c 'import dmidecode'
-#. NiMA...
-go: test.c catsprintf.o libdmidecode.so dmidecode.o dmiopt.o dmioem.o util.o
- gcc -o go test.c -L. -I/usr/include/python2.4 -ldmidecode catsprintf.o dmidecode.o dmiopt.o dmioem.o util.o
-libdmidecode.so: dmidecode.o
- gcc -shared $< -o $@
-catsprintf.o: catsprintf.c catsprintf.h
- $(CC) $(CFLAGS) -c $< -o $@
-#. ...NiMA
-
#
# Programs
#
+#. NiMA...
#dmidecode : dmidecode.o dmiopt.o dmioem.o util.o
# $(CC) $(LDFLAGS) dmidecode.o dmiopt.o dmioem.o util.o -o $@
+dmidecode: test.c catsprintf.o libdmidecode.so dmidecode.o dmiopt.o dmioem.o util.o
+ $(CC) $(LDFLAGS) test.c -L. -I/usr/include/python2.4 -ldmidecode catsprintf.o dmidecode.o dmiopt.o dmioem.o util.o -o $@
+libdmidecode.so: dmidecode.o
+ $(CC) $(LDFLAGS) -shared $< -o $@
+catsprintf.o: catsprintf.c catsprintf.h
+ $(CC) $(CFLAGS) -c $< -o $@
+#. ...NiMA
+
biosdecode : biosdecode.o util.o
$(CC) $(LDFLAGS) biosdecode.o util.o -o $@
diff --git a/dmidecodemodule.c b/dmidecodemodule.c
index 7590063..7ef9caf 100644
--- a/dmidecodemodule.c
+++ b/dmidecodemodule.c
@@ -1,38 +1,4 @@
-#include <Python.h>
-
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include <unistd.h>
-
-#include "version.h"
-#include "config.h"
-#include "types.h"
-#include "util.h"
-#include "dmidecode.h"
-#include "dmiopt.h"
-#include "dmioem.h"
-
-#define EFI_NOT_FOUND (-1)
-#define EFI_NO_SMBIOS (-2)
-
-#include "catsprintf.h"
-#include "global.h"
-
-//http://docs.python.org/api/sequence.html#l2h-338
-// NeuralNuts: you usually use PySquence_Fast() combined with
-// PySquence_Fast_GET_ITEM, but since you know you have a tuple,
-// PySequence_ITEM or PyTuple_GET_ITEM will be fine.
-//
-//
-extern void dmi_dump(struct dmi_header *h, const char *prefix);
-extern void dmi_decode(struct dmi_header *h, u16 ver);
-extern int address_from_efi(size_t *address);
-extern void to_dmi_header(struct dmi_header *h, u8 *data);
-extern void dmi_table(u32 base, u16 len, u16 num, u16 ver, const char *devmem);
-extern int smbios_decode(u8 *buf, const char *devmem);
-extern int legacy_decode(u8 *buf, const char *devmem);
-extern void *mem_chunk(size_t base, size_t len, const char *devmem);
+#include "dmidecodemodule.h"
static PyObject* dmidecode_get(PyObject *self, PyObject *args) {
PyObject *list = PyList_New(0);
diff --git a/dmidecodemodule.h b/dmidecodemodule.h
new file mode 100644
index 0000000..3d555c5
--- /dev/null
+++ b/dmidecodemodule.h
@@ -0,0 +1,37 @@
+#include <Python.h>
+
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+#include "version.h"
+#include "config.h"
+#include "types.h"
+#include "util.h"
+#include "dmidecode.h"
+#include "dmiopt.h"
+#include "dmioem.h"
+
+#define EFI_NOT_FOUND (-1)
+#define EFI_NO_SMBIOS (-2)
+
+#include "catsprintf.h"
+#include "global.h"
+
+//http://docs.python.org/api/sequence.html#l2h-338
+// NeuralNuts: you usually use PySquence_Fast() combined with
+// PySquence_Fast_GET_ITEM, but since you know you have a tuple,
+// PySequence_ITEM or PyTuple_GET_ITEM will be fine.
+//
+//
+extern void dmi_dump(struct dmi_header *h, const char *prefix);
+extern void dmi_decode(struct dmi_header *h, u16 ver);
+extern int address_from_efi(size_t *address);
+extern void to_dmi_header(struct dmi_header *h, u8 *data);
+extern void dmi_table(u32 base, u16 len, u16 num, u16 ver, const char *devmem);
+extern int smbios_decode(u8 *buf, const char *devmem);
+extern int legacy_decode(u8 *buf, const char *devmem);
+extern void *mem_chunk(size_t base, size_t len, const char *devmem);
+
+