From 7c0e0026ba7e37a746d1bb346bfe02c4aa1f8ac5 Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Mon, 25 Apr 2016 23:27:48 -0400 Subject: add `make static` and `make all` --- .gitignore | 1 + Makefile | 10 +++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) 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) -- cgit v1.2.3