]> pd.if.org Git - zpackage/blobdiff - Makefile
large commit of C work
[zpackage] / Makefile
index 239047f9d40cb0113e1866151736d9315c4d4204..053af317e05bcf4e425210a4d6bf306ddc58cc92 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,12 @@
-CFLAGS=-Wall -std=c99
+CFLAGS=-Wall -std=c99 -I. -L.
+LDFLAGS=-L.
 
-programs: elftype soname
+def: libzpm.a
+
+programs: elftype soname zpm-addfile zpm-extract
+
+uncompress: uncompress.o 
+       $(CC) $(CFLAGS) -o $@ $+ -llzma -lsqlite3
 
 elftype: elf/elftype.c
        $(CC) $(CFLAGS) -o $@ $+
@@ -8,6 +14,20 @@ elftype: elf/elftype.c
 soname: elf/soname.c
        $(CC) $(CFLAGS) -o $@ $+
 
+zpm-addfile: zpm-addfile.o libzpm.a
+       $(CC) $(CFLAGS) -o $@ $< -lsqlite3 -llzma -lzpm
+
+zpm-extract: zpm-extract.o libzpm.a
+       $(CC) $(CFLAGS) -o $@ $< -lsqlite3 -llzma -lzpm
+
+newdb.c: db.sql
+       echo "char createdb[] = {" > $@
+       xxd -i < $< >> $@
+       echo "};" >> $@
+
+libzpm.a: lib/sha256.o lib/db.o lib/compress.o lib/uncompress.o newdb.o lib/zpm.o
+       ar rcuv $@ $+
+
 install: elftype
        install -D zpm $(DESTDIR)/bin/zpm
        install -D zpm-note $(DESTDIR)/bin/zpm-note
@@ -21,3 +41,6 @@ install: elftype
        install -D elftype $(DESTDIR)/usr/sbin/elftype
        install -D soname $(DESTDIR)/usr/sbin/soname
        #SPOOL=$(DESTDIR)/var/lib/admin/notes ./zpm-sequence -c notes
+
+clean:
+       rm -f *.o