Simplified Makefiles.
This commit is contained in:
parent
58fdfcb573
commit
4f2a13217c
19
Makefile
19
Makefile
@ -1,19 +1,8 @@
|
|||||||
SUBDIRS := libhashset example test
|
SUBDIRS := libhashset example test
|
||||||
|
|
||||||
BUILD_ALL := $(patsubst %,build\:%,$(SUBDIRS))
|
.PHONY: all clean test $(SUBDIRS)
|
||||||
CLEAN_ALL := $(patsubst %,clean\:%,$(SUBDIRS))
|
|
||||||
|
|
||||||
.PHONY: all test clean $(BUILD_ALL) $(CLEAN_ALL)
|
all clean test: $(SUBDIRS)
|
||||||
|
|
||||||
all: $(BUILD_ALL)
|
$(SUBDIRS):
|
||||||
|
$(MAKE) -C $@ $(MAKECMDGOALS)
|
||||||
clean: $(CLEAN_ALL)
|
|
||||||
|
|
||||||
$(BUILD_ALL):
|
|
||||||
$(MAKE) -C $(patsubst build:%,%,$@)
|
|
||||||
|
|
||||||
$(CLEAN_ALL):
|
|
||||||
$(MAKE) -C $(patsubst clean:%,%,$@) clean
|
|
||||||
|
|
||||||
test: $(BUILD_ALL)
|
|
||||||
$(MAKE) -C test test
|
|
||||||
|
@ -1,16 +1,8 @@
|
|||||||
SUBDIRS := hash-set hash-map
|
SUBDIRS := hash-set hash-map
|
||||||
|
|
||||||
BUILD_ALL := $(patsubst %,build\:%,$(SUBDIRS))
|
.PHONY: all clean test $(SUBDIRS)
|
||||||
CLEAN_ALL := $(patsubst %,clean\:%,$(SUBDIRS))
|
|
||||||
|
|
||||||
.PHONY: all clean $(BUILD_ALL) $(CLEAN_ALL)
|
all clean test: $(SUBDIRS)
|
||||||
|
|
||||||
all: $(BUILD_ALL)
|
$(SUBDIRS):
|
||||||
|
$(MAKE) -C $@ $(MAKECMDGOALS)
|
||||||
clean: $(CLEAN_ALL)
|
|
||||||
|
|
||||||
$(BUILD_ALL):
|
|
||||||
$(MAKE) -C $(patsubst build:%,%,$@)
|
|
||||||
|
|
||||||
$(CLEAN_ALL):
|
|
||||||
$(MAKE) -C $(patsubst clean:%,%,$@) clean
|
|
||||||
|
@ -10,11 +10,9 @@ ALL_PATH := $(SRC_PATH) $(BIN_PATH)
|
|||||||
BIN_FILE := $(BIN_PATH)/example-hash-map$(EXE_SUFFIX)
|
BIN_FILE := $(BIN_PATH)/example-hash-map$(EXE_SUFFIX)
|
||||||
SRC_FILE := $(wildcard $(SRC_PATH)/*.c)
|
SRC_FILE := $(wildcard $(SRC_PATH)/*.c)
|
||||||
|
|
||||||
.PHONY: all build clean
|
.PHONY: all clean test
|
||||||
|
|
||||||
all: clean build
|
all test: clean $(ALL_PATH) $(BIN_FILE)
|
||||||
|
|
||||||
build: $(ALL_PATH) $(BIN_FILE)
|
|
||||||
|
|
||||||
$(BIN_FILE): $(SRC_FILE)
|
$(BIN_FILE): $(SRC_FILE)
|
||||||
$(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS)
|
$(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS)
|
||||||
|
@ -10,11 +10,9 @@ ALL_PATH := $(SRC_PATH) $(BIN_PATH)
|
|||||||
BIN_FILE := $(BIN_PATH)/example-hash-set$(EXE_SUFFIX)
|
BIN_FILE := $(BIN_PATH)/example-hash-set$(EXE_SUFFIX)
|
||||||
SRC_FILE := $(wildcard $(SRC_PATH)/*.c)
|
SRC_FILE := $(wildcard $(SRC_PATH)/*.c)
|
||||||
|
|
||||||
.PHONY: all build clean
|
.PHONY: all clean test
|
||||||
|
|
||||||
all: clean build
|
all test: clean $(ALL_PATH) $(BIN_FILE)
|
||||||
|
|
||||||
build: $(ALL_PATH) $(BIN_FILE)
|
|
||||||
|
|
||||||
$(BIN_FILE): $(SRC_FILE)
|
$(BIN_FILE): $(SRC_FILE)
|
||||||
$(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS)
|
$(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS)
|
||||||
|
@ -11,10 +11,12 @@ SRC_FILE := $(wildcard $(SRC_PATH)/*.c)
|
|||||||
OBJ_FILE := $(addprefix $(OBJ_PATH)/,$(patsubst %.c,%.o,$(notdir $(SRC_FILE))))
|
OBJ_FILE := $(addprefix $(OBJ_PATH)/,$(patsubst %.c,%.o,$(notdir $(SRC_FILE))))
|
||||||
LIB_FILE := $(LIB_PATH)/libhashset-1.a
|
LIB_FILE := $(LIB_PATH)/libhashset-1.a
|
||||||
|
|
||||||
.PHONY: all build clean
|
.PHONY: all build clean test
|
||||||
|
|
||||||
all: clean build
|
all: clean build
|
||||||
|
|
||||||
|
test: build
|
||||||
|
|
||||||
build: $(ALL_PATH) $(LIB_FILE)
|
build: $(ALL_PATH) $(LIB_FILE)
|
||||||
|
|
||||||
$(LIB_FILE): $(OBJ_FILE)
|
$(LIB_FILE): $(OBJ_FILE)
|
||||||
|
@ -1,22 +1,8 @@
|
|||||||
SUBDIRS := hash-set hash-map
|
SUBDIRS := hash-set hash-map
|
||||||
|
|
||||||
BUILD_ALL := $(patsubst %,build\:%,$(SUBDIRS))
|
.PHONY: all clean test $(SUBDIRS)
|
||||||
CLEAN_ALL := $(patsubst %,clean\:%,$(SUBDIRS))
|
|
||||||
TESTS_ALL := $(patsubst %,rtest\:%,$(SUBDIRS))
|
|
||||||
|
|
||||||
.PHONY: all clean test $(BUILD_ALL) $(CLEAN_ALL) $(TESTS_ALL)
|
all clean test: $(SUBDIRS)
|
||||||
|
|
||||||
all: $(BUILD_ALL)
|
$(SUBDIRS):
|
||||||
|
$(MAKE) -C $@ $(MAKECMDGOALS)
|
||||||
clean: $(CLEAN_ALL)
|
|
||||||
|
|
||||||
test: $(TESTS_ALL)
|
|
||||||
|
|
||||||
$(BUILD_ALL):
|
|
||||||
$(MAKE) -C $(patsubst build:%,%,$@)
|
|
||||||
|
|
||||||
$(CLEAN_ALL):
|
|
||||||
$(MAKE) -C $(patsubst clean:%,%,$@) clean
|
|
||||||
|
|
||||||
$(TESTS_ALL):
|
|
||||||
$(MAKE) -C $(patsubst rtest:%,%,$@) test
|
|
||||||
|
@ -10,11 +10,9 @@ ALL_PATH := $(SRC_PATH) $(BIN_PATH)
|
|||||||
BIN_FILE := $(BIN_PATH)/test-hash-set$(EXE_SUFFIX)
|
BIN_FILE := $(BIN_PATH)/test-hash-set$(EXE_SUFFIX)
|
||||||
SRC_FILE := $(wildcard $(SRC_PATH)/*.c)
|
SRC_FILE := $(wildcard $(SRC_PATH)/*.c)
|
||||||
|
|
||||||
.PHONY: all build clean test
|
.PHONY: all clean test
|
||||||
|
|
||||||
all: clean build
|
all: clean $(ALL_PATH) $(BIN_FILE)
|
||||||
|
|
||||||
build: $(ALL_PATH) $(BIN_FILE)
|
|
||||||
|
|
||||||
$(BIN_FILE): $(SRC_FILE)
|
$(BIN_FILE): $(SRC_FILE)
|
||||||
$(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS)
|
$(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS)
|
||||||
@ -22,8 +20,8 @@ $(BIN_FILE): $(SRC_FILE)
|
|||||||
$(ALL_PATH):
|
$(ALL_PATH):
|
||||||
mkdir -p $@
|
mkdir -p $@
|
||||||
|
|
||||||
|
test: all
|
||||||
|
./$(BIN_FILE)
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -vf $(BIN_FILE)
|
rm -vf $(BIN_FILE)
|
||||||
|
|
||||||
test: build
|
|
||||||
./$(BIN_FILE)
|
|
||||||
|
@ -10,11 +10,9 @@ ALL_PATH := $(SRC_PATH) $(BIN_PATH)
|
|||||||
BIN_FILE := $(BIN_PATH)/test-hash-set$(EXE_SUFFIX)
|
BIN_FILE := $(BIN_PATH)/test-hash-set$(EXE_SUFFIX)
|
||||||
SRC_FILE := $(wildcard $(SRC_PATH)/*.c)
|
SRC_FILE := $(wildcard $(SRC_PATH)/*.c)
|
||||||
|
|
||||||
.PHONY: all build clean test
|
.PHONY: all clean test
|
||||||
|
|
||||||
all: clean build
|
all: clean $(ALL_PATH) $(BIN_FILE)
|
||||||
|
|
||||||
build: $(ALL_PATH) $(BIN_FILE)
|
|
||||||
|
|
||||||
$(BIN_FILE): $(SRC_FILE)
|
$(BIN_FILE): $(SRC_FILE)
|
||||||
$(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS)
|
$(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS)
|
||||||
@ -22,8 +20,8 @@ $(BIN_FILE): $(SRC_FILE)
|
|||||||
$(ALL_PATH):
|
$(ALL_PATH):
|
||||||
mkdir -p $@
|
mkdir -p $@
|
||||||
|
|
||||||
|
test: all
|
||||||
|
./$(BIN_FILE)
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -vf $(BIN_FILE)
|
rm -vf $(BIN_FILE)
|
||||||
|
|
||||||
test: build
|
|
||||||
./$(BIN_FILE)
|
|
||||||
|
Loading…
Reference in New Issue
Block a user