Fixed and simplified makefile a bit.
This commit is contained in:
parent
dbf3de3d8e
commit
c06a92db6e
21
Makefile
21
Makefile
@ -35,27 +35,24 @@ test: build optimize
|
|||||||
@./nomsu_latest -c $<
|
@./nomsu_latest -c $<
|
||||||
|
|
||||||
.PHONY: check_header
|
.PHONY: check_header
|
||||||
check_header: version
|
check_header: $(PEG_FILE) nomsu.lua $(CORE_NOM_FILES) $(LIB_NOM_FILES)
|
||||||
@if [ -f nomsu_latest ]; then \
|
@if [ -f nomsu_latest ]; then \
|
||||||
NOMSU_HEADER="#!$(LUA_BIN)\\npackage.path = [[$(NOMSU_LIB_DIR)/$$(cat version)/?.lua;]]..package.path\\npackage.nomsupath = [[$(NOMSU_LIB_DIR)/$$(cat version)]]"; \
|
NOMSU_HEADER="#!$(LUA_BIN)\\npackage.path = [[$(NOMSU_LIB_DIR)/`$(GET_VERSION)`/?.lua;]]..package.path\\npackage.nomsupath = [[$(NOMSU_LIB_DIR)/`$(GET_VERSION)`]]"; \
|
||||||
if [ "`head -n 3 nomsu_latest 2>/dev/null`" != "`echo $$NOMSU_HEADER`" ]; then \
|
if [ "`head -n 3 nomsu_latest 2>/dev/null`" != "`echo $$NOMSU_HEADER`" ]; then \
|
||||||
rm -f nomsu_latest; \
|
rm -f nomsu_latest; \
|
||||||
fi; \
|
fi; \
|
||||||
fi;
|
fi;
|
||||||
|
|
||||||
version: $(PEG_FILE) nomsu.lua $(CORE_NOM_FILES) $(LIB_NOM_FILES)
|
|
||||||
@$(LUA_BIN) nomsu.lua --version > version
|
|
||||||
|
|
||||||
nomsu_latest: nomsu.lua
|
nomsu_latest: nomsu.lua
|
||||||
@rm -f nomsu_latest
|
@rm -f nomsu_latest
|
||||||
@NOMSU_HEADER="#!$(LUA_BIN)\\npackage.path = [[$(NOMSU_LIB_DIR)/$$(cat version)/?.lua;]]..package.path\\npackage.nomsupath = [[$(NOMSU_LIB_DIR)/$$(cat version)]]"; \
|
@NOMSU_HEADER="#!$(LUA_BIN)\\npackage.path = [[$(NOMSU_LIB_DIR)/`$(GET_VERSION)`/?.lua;]]..package.path\\npackage.nomsupath = [[$(NOMSU_LIB_DIR)/`$(GET_VERSION)`]]"; \
|
||||||
echo $$NOMSU_HEADER | cat - nomsu.lua > nomsu_latest
|
echo $$NOMSU_HEADER | cat - nomsu.lua > nomsu_latest
|
||||||
@chmod +x nomsu_latest
|
@chmod +x nomsu_latest
|
||||||
@mv -f nomsu_latest nomsu`./nomsu_latest --version`
|
@mv -f nomsu_latest nomsu`$(GET_VERSION)`
|
||||||
@ln -s nomsu`$(LUA_BIN) nomsu.lua --version` nomsu_latest
|
@ln -s nomsu`$(GET_VERSION)` nomsu_latest
|
||||||
@echo "Built nomsu binary"
|
@echo "Built nomsu binary"
|
||||||
|
|
||||||
build: $(LUA_FILES) version check_header nomsu_latest
|
build: $(LUA_FILES) check_header nomsu_latest
|
||||||
|
|
||||||
.PHONY: optimize
|
.PHONY: optimize
|
||||||
optimize: build $(CORE_LUA_FILES) $(LIB_LUA_FILES)
|
optimize: build $(CORE_LUA_FILES) $(LIB_LUA_FILES)
|
||||||
@ -63,12 +60,12 @@ optimize: build $(CORE_LUA_FILES) $(LIB_LUA_FILES)
|
|||||||
.PHONY: clean
|
.PHONY: clean
|
||||||
clean:
|
clean:
|
||||||
@echo "Deleting..."
|
@echo "Deleting..."
|
||||||
@rm -rvf nomsu`./nomsu_latest --version 2>/dev/null` nomsu_latest core/*.lua lib/*.lua
|
@rm -rvf nomsu`$(GET_VERSION)` nomsu_latest core/*.lua lib/*.lua
|
||||||
|
|
||||||
.PHONY: install
|
.PHONY: install
|
||||||
install: all
|
install: all
|
||||||
mkdir -pv $(NOMSU_BIN_DIR) && cp -v nomsu nomsu`./nomsu_latest --version` $(NOMSU_BIN_DIR)
|
mkdir -pv $(NOMSU_BIN_DIR) && cp -v nomsu nomsu`$(GET_VERSION)` $(NOMSU_BIN_DIR)
|
||||||
mkdir -pv $(NOMSU_LIB_DIR)/`./nomsu_latest --version` && cp -rv $(LUA_FILES) $(PEG_FILE) core lib $(NOMSU_LIB_DIR)/`./nomsu_latest --version`
|
mkdir -pv $(NOMSU_LIB_DIR)/`$(GET_VERSION)` && cp -rv $(LUA_FILES) $(PEG_FILE) core lib $(NOMSU_LIB_DIR)/`$(GET_VERSION)`
|
||||||
|
|
||||||
.PHONY: uninstall
|
.PHONY: uninstall
|
||||||
uninstall: all
|
uninstall: all
|
||||||
|
Loading…
Reference in New Issue
Block a user