summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2016-04-25 23:27:48 -0400
committerJesse Luehrs <doy@tozt.net>2016-04-25 23:29:02 -0400
commit7c0e0026ba7e37a746d1bb346bfe02c4aa1f8ac5 (patch)
treed21f68fb193449866f8acc1a6601b33beae6fdd9
parentc59da47832a34a016da82782ff39dc83b0c3890f (diff)
downloadlibvt100-7c0e0026ba7e37a746d1bb346bfe02c4aa1f8ac5.tar.gz
libvt100-7c0e0026ba7e37a746d1bb346bfe02c4aa1f8ac5.zip
add `make static` and `make all`
-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)