From 08bc395716446d5ca94b7e87fc59b5d3398609cb Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Sat, 4 Jun 2016 19:58:41 -0400 Subject: add a makefile target for examples --- Makefile | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index ec99c92..8c4d341 100644 --- a/Makefile +++ b/Makefile @@ -2,6 +2,8 @@ OUT = libvt100.so SOUT = libvt100.a BUILD = build/ SRC = src/ +EXDIR = examples/ +EXAMPLES = $(EXDIR)test1 OBJ = $(BUILD)parser.o \ $(BUILD)screen.o \ $(BUILD)unicode-extra.o @@ -28,6 +30,8 @@ dynamic: $(OUT) ## Build a dynamic library static: $(SOUT) ## Build a static library +examples: $(EXAMPLES) ## Build the example programs + $(OUT): $(OBJ) $(QUIET_LD)$(CC) -fPIC -shared -o $@ $^ $(ALLLDFLAGS) @@ -38,6 +42,9 @@ $(BUILD)%.o: $(SRC)%.c | $(BUILD) @$(MAKEDEPEND) -o $(<:$(SRC)%.c=$(BUILD).%.d) $< $(QUIET_CC)$(CC) $(ALLCFLAGS) -c -fPIC -o $@ $< +$(EXDIR)%: $(EXDIR)%.c $(SOUT) + $(QUIET_CC)$(CC) $(ALLCFLAGS) $(ALLLDFLAGS) -I src -o $@ $^ + $(BUILD): @mkdir -p $(BUILD) @@ -50,7 +57,7 @@ $(SRC)%.h: $(SRC)%.l $(QUIET_LEX)$(LEX) --header-file=$(<:.l=.h) -o /dev/null $< clean: ## Remove build files - rm -f $(OUT) $(SOUT) $(OBJ) $(OBJ:$(BUILD)%.o=$(BUILD).%.d) + rm -f $(OUT) $(SOUT) $(OBJ) $(OBJ:$(BUILD)%.o=$(BUILD).%.d) $(EXAMPLES) @rmdir -p $(BUILD) > /dev/null 2>&1 || true help: ## Display this help -- cgit v1.2.3