]> pd.if.org Git - zpackage/blobdiff - Makefile
large commit of C work
[zpackage] / Makefile
index 780114a775b05b678f60d2200b509d36eff686d3..053af317e05bcf4e425210a4d6bf306ddc58cc92 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,4 +1,12 @@
-CFLAGS=-Wall -std=c99
+CFLAGS=-Wall -std=c99 -I. -L.
+LDFLAGS=-L.
+
+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 $@ $+
@@ -6,11 +14,26 @@ 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
        install -D zpm-bug $(DESTDIR)/bin/zpm-bug
        install -D zpm-sequence $(DESTDIR)/bin/zpm-sequence
+       install -D zpm-preserve $(DESTDIR)/bin/zpm-preserve
        install -d -m2770 -o root -g adm $(DESTDIR)/var/lib/admin
        install -d -m2770 -o root -g adm $(DESTDIR)/var/lib/admin/notes
        install -d -m2770 -o root -g adm $(DESTDIR)/var/lib/admin/notes/open
@@ -18,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