我需要在目标上评估一些宏,但我无法通过$ ^得到SELECT *
FROM (
SELECT *, lag(data, 1, '-infinity') OVER (PARTITION BY id ORDER BY dt) AS last_data
FROM mydat
) t
WHERE last_data IS DISTINCT FROM '-infinity';
进行评估。这是我的makefile:
OBJECT_FILE
我得到的结果是:
#___________________________________build tools_________________________________
MKDIR := mkdir
RM := rm
CP := cp
CD := cd
COMPILER := gfortran
GENERAL_FLAGS := -fno-automatic -static -I/usr/include -fimplicit-none
TESTING_DEBUG_FLAGS := -Og -g -fbounds-check -fbacktrace -pedantic -Wextra \
-Wall ${GENERAL_FLAGS}
RELEASE_FLAGS := ${GENERAL_FLAGS} -Ofast
#______________________________macros de diretórios_____________________________
SRC_DIR := src
BUILD_DIR := build
RELEASE_DIR := release
DEBUG_DIR := debug
TEST_DIR := test
DIST_DIR := dist
PROGRAM := ${DIST_DIR}/SimulArroz
#______________________________regras de compilação_____________________________
tests: | TEST_PATHS ${PROGRAM}
TEST_PATHS:
$(eval FLAGS = ${TESTING_DEBUG_FLAGS})
$(eval OBJECT_DIR = ${BUILD_DIR}/${TEST_DIR})
$(eval OBJECT_FILES = ${OBJECT_DIR}/Data.o ${OBJECT_DIR}/Model.o \
${OBJECT_DIR}/Control.o ${OBJECT_DIR}/Farmings.o \
${OBJECT_DIR}/Test_data.o ${OBJECT_DIR}/Test_main.o \
${OBJECT_DIR}/Test_subroutines.o)
${MKDIR} -p ${DIST_DIR}
${MKDIR} -p ${OBJECT_DIR}
clean :
${RM} -fr ${BUILD_DIR}
${RM} -fr ${DIST_DIR}
${RM} -f seed.mod
run :
${CD} ${DIST_DIR} ; ./${PROGRAM}
${PROGRAM}: ${OBJECT_FILES}
${COMPILER} ${FLAGS} -o $@ $^
${OBJECT_DIR}/%.o: ${SRC_DIR}/%.f90
${MKDIR} -p ${OBJECT_DIR}
${COMPILER} ${FLAGS} -c -o $@ $<
更新
我按照评论中的指示尝试了gfortran -Og -g -fbounds-check -fbacktrace -pedantic -Wextra -Wall -fno-automatic -static -I/usr/include -fimplicit-none -o dist/SimulArroz
gfortran: fatal error: no input files; unwilling to write output files
compilation terminated.
makefile:90: recipe for target 'dist/SimulArroz' failed
make: *** [dist/SimulArroz] Error 1
,但最后在我的情况下它给出了相同的结果,以下是我尝试过的更改:
secondary expansion
答案 0 :(得分:0)
好的,我进一步调查了一下,正如问题评论所指出的那样,使用second expansion
可以解决我的问题,我也使用text function
。由于没有人给我答案,我把它放在这里:
#___________________________________build tools_________________________________
MKDIR := mkdir -p
RM := rm
CP := cp
CD := cd
COMPILER := gfortran
# flags do compilador
GENERAL_FLAGS := -fno-automatic -static -I/usr/include -fimplicit-none
TESTING_DEBUG_FLAGS := -Og -g -fbounds-check -fbacktrace -pedantic -Wextra \
-Wall ${GENERAL_FLAGS}
RELEASE_FLAGS := ${GENERAL_FLAGS} -Ofast
#______________________________macros de diretórios_____________________________
SRC_DIR := src
BUILD_DIR := build
RELEASE_DIR := release
DEBUG_DIR := debug
TEST_DIR := test
DIST_DIR := dist
test_FILES := Data.o Model.o Control.o Farmings.o Test_Data.o Test_Main.o \
Test_Subroutines.o
#______________________________regras de compilação_____________________________
.PHONY: test clean run
test: FLAGS := ${TESTING_DEBUG_FLAGS} -o
test: OBJ_DIR := ${BUILD_DIR}/${TEST_DIR}
test: PROGRAM_DIR := ${DIST_DIR}/${TEST_DIR}
test: PROGRAM := ${PROGRAM_DIR}/SimulArroz
.SECONDEXPANSION:
test: $${$$@_FILES}
${MKDIR} ${PROGRAM_DIR}
${COMPILER} ${FLAGS} ${PROGRAM} $($@_FILES:%o=${OBJ_DIR}/%o)
%.o: ${SRC_DIR}/%.f90
${MKDIR} ${OBJ_DIR}
${COMPILER} -c ${FLAGS} ${OBJ_DIR}/$@ $<
clean :
${RM} -fr ${BUILD_DIR}
${RM} -fr ${DIST_DIR}
${RM} -f seed.mod
run :
${CD} ${DIST_DIR} ; ./${PROGRAM}
但是......我仍然无法理解为什么我无法获得如下目标:
${OBJ_DIR}/%.o: ${SRC_DIR}/%.f90
${MKDIR} ${OBJ_DIR}
${COMPILER} -c ${FLAGS} $@ $<
如果在目标中使用,则${OBJ_DIR}
未展开。如果有人可以解释在这种情况下发生的事情,我会非常感激。
我还要感谢我在评论中收到的建议。