wrapperscript generation from makefile
This commit is contained in:
parent
6fea192c60
commit
20348ed1e9
1 changed files with 28 additions and 5 deletions
33
Makefile
33
Makefile
|
|
@ -2,9 +2,20 @@
|
||||||
# Archive Makefile
|
# Archive Makefile
|
||||||
#
|
#
|
||||||
|
|
||||||
|
# uncomment and edit this to match your system
|
||||||
|
#DB_HOST := localhost
|
||||||
|
#DB_USER := dbusr
|
||||||
|
#DB_PASS := dbpass
|
||||||
|
#DB_NAME := dbname
|
||||||
|
#DB_TBL := dbtable
|
||||||
|
|
||||||
|
ifdef DEBUG
|
||||||
|
CFLAGS := -g
|
||||||
DEFS := -D__DEBUG__
|
DEFS := -D__DEBUG__
|
||||||
|
endif
|
||||||
|
|
||||||
LIBS := `mysql_config --libs`
|
LIBS := `mysql_config --libs`
|
||||||
CFLAGS := -Werror -g $(LIBS) $(DEFS)
|
CFLAGS := -Werror $(LIBS) $(DEFS)
|
||||||
CC := gcc
|
CC := gcc
|
||||||
|
|
||||||
SOURCES := \
|
SOURCES := \
|
||||||
|
|
@ -20,11 +31,23 @@ SOURCES := \
|
||||||
BUILD := ./build
|
BUILD := ./build
|
||||||
|
|
||||||
all :
|
all :
|
||||||
make me
|
@mkdir -p $(BUILD)
|
||||||
|
ifdef DB_HOST
|
||||||
me :
|
make wrapper
|
||||||
mkdir -p $(BUILD)
|
else
|
||||||
|
@echo "Tip: edit this Makefile DB_* macros to enable generation of a wrapper shellscript"
|
||||||
|
endif
|
||||||
$(CC) $(CFLAGS) $(SOURCES) -o $(BUILD)/arch
|
$(CC) $(CFLAGS) $(SOURCES) -o $(BUILD)/arch
|
||||||
|
|
||||||
|
wrapper :
|
||||||
|
@echo "#!/bin/sh" > $(BUILD)/wrapper
|
||||||
|
@echo "if [ \$$# -lt 1 ]; then" >> $(BUILD)/wrapper
|
||||||
|
@echo " echo \"usage: \$$0 <rootdir>\"" >> $(BUILD)/wrapper
|
||||||
|
@echo " exit" >> $(BUILD)/wrapper
|
||||||
|
@echo "fi" >> $(BUILD)/wrapper
|
||||||
|
@echo "./arch \"\$$1\" \"$(DB_HOST)\" \"$(DB_USER)\" \"$(DB_PASS)\" \"$(DB_NAME)\" \"$(DB_TBL)\"" >> $(BUILD)/wrapper
|
||||||
|
@chmod 755 $(BUILD)/wrapper
|
||||||
|
@echo "generated $(BUILD)/wrapper"
|
||||||
|
|
||||||
clean :
|
clean :
|
||||||
rm -fr $(BUILD)
|
rm -fr $(BUILD)
|
||||||
|
|
|
||||||
Reference in a new issue