summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--Makefile10
2 files changed, 10 insertions, 1 deletions
diff --git a/.gitignore b/.gitignore
index f9d502a..64ab2be 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,2 +1,3 @@
/build
libvt100.so
+libvt100.a
diff --git a/Makefile b/Makefile
index 113658c..f5da9c9 100644
--- a/Makefile
+++ b/Makefile
@@ -1,4 +1,5 @@
OUT = libvt100.so
+SOUT = libvt100.a
BUILD = build/
SRC = src/
OBJ = $(BUILD)parser.o \
@@ -12,11 +13,18 @@ ALLLDFLAGS = $(shell pkg-config --libs $(LIBS)) $(LDFLAGS)
MAKEDEPEND = $(CC) $(ALLCFLAGS) -M -MP -MT '$@ $(@:$(BUILD)%.o=$(BUILD).%.d)'
+all: $(OUT) $(SOUT)
+
build: $(OUT)
+static: $(SOUT)
+
$(OUT): $(OBJ)
$(CC) $(ALLLDFLAGS) -fPIC -shared -o $@ $^
+$(SOUT): $(OBJ)
+ $(AR) rcs $@ $^
+
$(BUILD)%.o: $(SRC)%.c
@mkdir -p $(BUILD)
@$(MAKEDEPEND) -o $(<:$(SRC)%.c=$(BUILD).%.d) $<
@@ -31,7 +39,7 @@ $(SRC)%.h: $(SRC)%.l
$(LEX) --header-file=$(<:.l=.h) -o /dev/null $<
clean:
- rm -f $(OUT) $(OBJ) $(OBJ:$(BUILD)%.o=$(BUILD).%.d)
+ rm -f $(OUT) $(SOUT) $(OBJ) $(OBJ:$(BUILD)%.o=$(BUILD).%.d)
@rmdir -p $(BUILD) > /dev/null 2>&1
-include $(OBJ:$(BUILD)%.o=$(BUILD).%.d)