Added a static library

This commit is contained in:
Morten Delenk 2016-02-20 10:39:33 +01:00
parent f2988212b0
commit 60d40ac81b

View file

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