2016年7月21日木曜日

configure作成

#
# 1.サンプルソース作成
#
cat <<__EOF__> a.c
#include <stdio.h>
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif

int main(int argc, char *argv[])
{
fprintf(stdout, "1\n");
fprintf(stderr, "2\n");
return 0;
}
__EOF__

#
# 2.雛形Makefile.in作成
#
cat <<__EOF__> Makefile.in

#
# Makefile
#
CC = @CC@
DEFS = @DEFS@
LIBS = @LIBS@

SRCS = a.c
OBJS = \$(SRCS:.c=.o)
PROG = a

all: \$(PROG)

\$(PROG): \$(OBJS)
 \$(CC) -o \$@ \$(OBJS) \$(LIBS)

.c.o:
 \$(CC) \$(DEFS) -c -o \$@ \$<

clean:
 rm -f \$(OBJS)
__EOF__

#
# 3.autoscanを実行してconfigure.in 作成
#
autoscan
mv configure.scan configure.in
#
# 4.autoheaderを実行してconfig.in 作成
#
autoheader
#
# 5.autoconfを実行してconfigure 作成
#
autoconf
#
# 6.configure実行してMakefile 作成
#
./configure

#
# 7.コンパイル
#
make

0 件のコメント:

コメントを投稿

シャットダウン時の後処理 (shutdown)

# vi /etc/systemd/system/drop.service [Unit] Description= stop httpgwd DefaultDependencies=no Before=shutdown.target RefuseManualStart=true ...