summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore4
-rw-r--r--Makefile25
-rw-r--r--SConstruct28
3 files changed, 32 insertions, 25 deletions
diff --git a/.gitignore b/.gitignore
index 7d0e7dc..de23a70 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,4 +1,8 @@
*.swp
*.o
+*.xml
/ircstats
/irclogs
+.sconf_temp
+.sconsign.dblite
+config.log
diff --git a/Makefile b/Makefile
deleted file mode 100644
index d06e101..0000000
--- a/Makefile
+++ /dev/null
@@ -1,25 +0,0 @@
-CC = gcc
-LD = gcc
-CFLAGS += -std=c99 -g
-CFLAGS += -D_GNU_SOURCE
-CFLAGS += $(shell pkg-config --cflags libconfig)
-CFLAGS += $(shell pcre-config --cflags)
-CFLAGS += $(shell xml2-config --cflags)
-CFLAGS += -pthread
-LDFLAGS += $(shell pkg-config --libs libconfig)
-LDFLAGS += $(shell pcre-config --libs)
-LDFLAGS += $(shell xml2-config --libs)
-LDFLAGS += -pthread
-OBJECTS = main.o config.o regexset.o channel.o user.o word.o sdbm.o export_xml.o nick.o parsing.o
-TARGET = ircstats
-
-all: $(TARGET)
-
-$(TARGET): $(OBJECTS)
- $(LD) $(LDFLAGS) -o $@ $^
-
-%.o: %.c
- $(CC) $(CFLAGS) -c -o $@ $<
-
-clean:
- rm -f $(OBJECTS) $(TARGET)
diff --git a/SConstruct b/SConstruct
new file mode 100644
index 0000000..2de6c3c
--- /dev/null
+++ b/SConstruct
@@ -0,0 +1,28 @@
+import os
+
+env = Environment()
+
+conf = Configure(env)
+for lib in ('config', 'pcre', 'xml2', 'pthread'):
+ if not conf.CheckLib(lib):
+ print 'Could not find %s' % lib
+ Exit(1)
+env = conf.Finish()
+
+env.Append(CCFLAGS = ['-std=c99', '-D_GNU_SOURCE', '-pthread'])
+
+if 'DEBUG' in os.environ:
+ print 'Debug build'
+ env.Append(CCFLAGS = ['-g'])
+else:
+ print 'Release build'
+ env.Append(CCFLAGS = ['-O2'])
+
+env.Append(LINKFLAGS = ['-pthread'])
+env.ParseConfig('pkg-config --cflags --libs libconfig')
+env.ParseConfig('pcre-config --cflags --libs')
+env.ParseConfig('xml2-config --cflags --libs')
+
+env.Program('ircstats', Glob('*.c'))
+
+# vim: syn=python