diff --git a/makefile b/makefile index 3806ddf..3c26b48 100644 --- a/makefile +++ b/makefile @@ -3,20 +3,22 @@ # See copying.txt for legal information. CFLAGS += -std=c99 -Os -Wall -s -fpic - # Add extension when compiling for Windows ifdef SystemRoot CC = gcc EXT = .exe + LIBEXT = .dll RM = del +else + LIBEXT = .so endif # Comment this line to suppress detailed decompression information on stdout -#DEFINES += -DEXTRA_OUT +DEFINES += -DEXTRA_OUT # Uncomment this line to enable debug output -#DEFINES += -DDEBUG_OUT +DEFINES += -DDEBUG_OUT -all: inhal$(EXT) exhal$(EXT) +all: inhal$(EXT) exhal$(EXT) libexhal$(LIBEXT) libexhal.a clean: $(RM) inhal$(EXT) exhal$(EXT) compress.o libexhal.so @@ -30,13 +32,15 @@ exhal$(EXT): exhal.c compress.o compress.o: compress.c $(CC) $(DEFINES) $(CFLAGS) -c compress.c -libexhal.so: compress.o +libexhal$(LIBEXT): compress.o gcc -shared -o $@ $^ - +libexhal.a: compress.o + ar rcs $@ $^ install: all libexhal.so mkdir -pv /usr/local/bin cp inhal$(EXT) exhal$(EXT) /usr/local/bin mkdir -pv /usr/local/lib - cp libexhal.so /usr/local/lib + cp libexhal$(LIBEXT) /usr/local/lib + cp libexhal.a /usr/local/lib mkdir -pv /usr/local/include cp include/* /usr/local/include