我想在我的静态库中使用Makefile,我可以有条件地将其构建为执行简单自检的程序。我目前的Makefille看起来如下:
OBJECTS = sm3.o ./core/sm3_internal.o
INCLUDES = -I. -I./core
CFLAGS = -g -Wall -O3
CC = c99
OUT = libsm3.a
%.o: %.c
$(CC) -c -o $@ $< $(CFLAGS) $(INCLUDES)
$(OUT): $(OBJECTS)
ar rcs $(OUT) $(OBJECTS)
在我的主库文件中,我有:
#ifdef TEST
main(int argc, int* argv[])
{
//my self-test logic here
}
#endif
我应该在哪里添加-DTEST标志?如果我将它添加到CFLAGS然后添加行:
test: $(OBJECTS)
库也将使用main构建,这显然不是我想要的东西。
答案 0 :(得分:1)
我建议您有条件地编译Key ==>MIBDIRS
Value ==>C:/xampp/php/extras/mibs
Key ==>MYSQL_HOME
Value ==>\xampp\mysql\bin
Key ==>OPENSSL_CONF
Value ==>C:/xampp/apache/bin/openssl.cnf
Key ==>PHP_PEAR_SYSCONF_DIR
Value ==>\xampp\php
Key ==>PHPRC
Value ==>\xampp\php
Key ==>TMP
Value ==>\xampp\tmp
Key ==>HTTP_HOST
Value ==>localhost:8080
Key ==>HTTP_CONNECTION
Value ==>keep-alive
Key ==>CONTENT_LENGTH
Value ==>305658
Key ==>HTTP_ORIGIN
Value ==>http://localhost:8080
Key ==>HTTP_USER_AGENT
Value ==>Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.82 Safari/537.36
Key ==>CONTENT_TYPE
Value ==>multipart/form-data
Key ==>HTTP_ACCEPT
Value ==>*/*
Key ==>HTTP_DNT
Value ==>1
Key ==>HTTP_REFERER
Value ==>http://localhost:8080/task3/
Key ==>HTTP_ACCEPT_ENCODING
Value ==>gzip, deflate
Key ==>HTTP_ACCEPT_LANGUAGE
Value ==>en-US,en;q=0.8,id;q=0.6
Key ==>HTTP_COOKIE
Value ==>PHPSESSID=crk3e9v9m4ri6k2nn8snhihu67
Key ==>PATH
Value ==>C:\Python33\;C:\ProgramData\Oracle\Java\javapath;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\ATI Technologies\ATI.ACE\Core-Static;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Windows Kits\8.1\Windows Performance Toolkit\;C:\Program Files\Microsoft SQL Server\110\Tools\Binn\;C:\Program Files\TortoiseSVN\bin;C:\Program Files\Microsoft SQL Server\120\Tools\Binn\;C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\110\Tools\Binn\;C:\Program Files (x86)\Microsoft SQL Server\120\Tools\Binn\;C:\Program Files\Microsoft SQL Server\120\DTS\Binn\;C:\Program Files (x86)\Microsoft SQL Server\120\Tools\Binn\ManagementStudio\;C:\Program Files (x86)\Microsoft SQL Server\120\DTS\Binn\;C:\Program Files (x86)\Skype\Phone\;C:\Program Files\Microsoft\Web Platform Installer\;C:\Program Files\TortoiseGit\bin;C:\Program Files (x86)\Microsoft SDKs\TypeScript\1.0\;C:\Program Files\nodejs\;C:\xampp\php;C:\ProgramData\ComposerSetup\bin;
Key ==>SystemRoot
Value ==>C:\Windows
Key ==>COMSPEC
Value ==>C:\Windows\system32\cmd.exe
Key ==>PATHEXT
Value ==>.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC
Key ==>WINDIR
Value ==>C:\Windows
Key ==>SERVER_SIGNATURE
Value ==><address>Apache/2.4.12 (Win32) OpenSSL/1.0.1l PHP/5.5.24 Server at localhost Port 8080</address>
Key ==>SERVER_SOFTWARE
Value ==>Apache/2.4.12 (Win32) OpenSSL/1.0.1l PHP/5.5.24
Key ==>SERVER_NAME
Value ==>localhost
Key ==>SERVER_ADDR
Value ==>::1
Key ==>SERVER_PORT
Value ==>8080
Key ==>REMOTE_ADDR
Value ==>::1
Key ==>DOCUMENT_ROOT
Value ==>C:/xampp/htdocs
Key ==>REQUEST_SCHEME
Value ==>http
Key ==>CONTEXT_PREFIX
Value ==>
Key ==>CONTEXT_DOCUMENT_ROOT
Value ==>C:/xampp/htdocs
Key ==>SERVER_ADMIN
Value ==>postmaster@localhost
Key ==>SCRIPT_FILENAME
Value ==>C:/xampp/htdocs/task3/hisoka_drop.php
Key ==>REMOTE_PORT
Value ==>60706
Key ==>GATEWAY_INTERFACE
Value ==>CGI/1.1
Key ==>SERVER_PROTOCOL
Value ==>HTTP/1.1
Key ==>REQUEST_METHOD
Value ==>POST
Key ==>QUERY_STRING
Value ==>
Key ==>REQUEST_URI
Value ==>/task3/hisoka_drop.php
Key ==>SCRIPT_NAME
Value ==>/task3/hisoka_drop.php
Key ==>PHP_SELF
Value ==>/task3/hisoka_drop.php
Key ==>REQUEST_TIME_FLOAT
Value ==>1469489572.122
Key ==>REQUEST_TIME
Value ==>1469489572
Key ==>REQUEST_TIME
:
main.c