Is this a good way to be root in a makefile? - c

Is this a good way to be root in a makefile?
SHELL = /bin/sh
INSTDIR = /usr/bin/
OBJS = main.o file.o gen.o stat.o
program1: $(OBJS)
gcc -o program1 $(OBJS)
main.o: main.c file.h gen.h stat.h
gcc -c main.c
file.o: file.c file.h
gcc -c file.c
gen.o: gen.c gen.h
gcc -c gen.c
stat.o: stat.c stat.h
gcc -c stat.c
clean:
rm -f $(OBJS) program1
install:
#if [ -f program1 ]; then \
if [ $$(id -u) -eq 0 ]; then \
cp program1 $(INSTDIR) && \
echo "Installed in $(INSTDIR)" ; \
else \
(sudo cp program1 $(INSTDIR) 2> /dev/null && \
echo "Installed in $(INSTDIR)") || \
(echo 'No sudo on this machine, trying su.' \
&& su -c "cp program1 $(INSTDIR)" && \
echo "Installed in $(INSTDIR)") ; \
fi ; \
else \
echo "There was no program to install, run make." ; \
fi
uninstall:
#if [ -f $(INSTDIR)program1 ]; then \
if [ $$(id -u) -eq 0 ]; then \
rm $(INSTDIR)program1 && \
echo "Uninstalled in $(INSTDIR)" ; \
else \
(sudo rm $(INSTDIR)program1 2> /dev/null && \
echo "Uninstalled in $(INSTDIR)") || \
(echo 'No sudo on this machine, trying su.' \
&& su -c "rm $(INSTDIR)program1" && \
echo "Uninstalled in $(INSTDIR)") ; \
fi ; \
else \
echo "There was no program to remove." ; \
fi

NO!
First, generally users do sudo make install. Second, you didn't think about cases when the program is installed into a custom directory, which doesn't always need root privileges. Packaging tools use this feature, for example, and they don't have root privileges.

Related

Static Nginx with Modsecurity

Trying to add Modsecurity v3.0.4 in to Nginx v1.19.9 but running in to some errors I do not understand. There are MANY errors similar to the ones I pasted below but did not include them all. My intention is to create a static Nginx binary and not use the dynamic Modsecurity module. Thanks for any help.
Dockerfile
FROM alpine:latest as build
#Define build argument for version
ARG NGNX_VERSION=1.19.8
ARG PCRE_VERSION=8.44
ARG OSSL_VERSION=1.1.1k
ARG ZLIB_VERSION=1.2.11
ARG GEO_DB_RELEASE=2021-04
ARG MODSEC_BRANCH=v3.0.4
ARG OWASP_BRANCH=v3.3/master
# Set working directory
WORKDIR /tmp
RUN echo "Installing Dependencies" && \
apk add --no-cache --virtual general-dependencies \
autoconf \
automake \
byacc \
build-base \
gnupg \
perl \
linux-headers \
pcre-dev \
wget \
geoip-dev \
curl-dev \
flex \
g++ \
gcc \
geoip-dev \
git \
libc-dev \
libmaxminddb-dev \
libstdc++ \
libtool \
libxml2-dev \
linux-headers \
lmdb-dev \
make \
openssl-dev \
pcre-dev \
yajl-dev \
zlib-dev
# Clone and compile modsecurity. Binary will be located in /usr/local/modsecurity
RUN echo "Installing ModSec Library" && \
git clone -b ${MODSEC_BRANCH} --depth 1 https://github.com/SpiderLabs/ModSecurity && \
git -C /tmp/ModSecurity submodule update --init --recursive && \
(cd "/tmp/ModSecurity" && \
./build.sh && \
./configure --with-lmdb && \
make -j 10 && \
make install \
)
# Retrieve required packages
RUN echo 'Cloning Modsec Nginx Connector, GeoIP, ModSec OWASP Rules, and download/extract nginx and GeoIP databases' && \
git clone -b master --depth 1 https://github.com/SpiderLabs/ModSecurity-nginx.git && \
git clone -b ${OWASP_BRANCH} --depth 1 https://github.com/coreruleset/coreruleset.git /usr/local/owasp-modsecurity-crs && \
wget -q https://www.openssl.org/source/openssl-$OSSL_VERSION.tar.gz && \
tar -xzf openssl-$OSSL_VERSION.tar.gz && \
wget -q https://ftp.pcre.org/pub/pcre/pcre-$PCRE_VERSION.tar.bz2 && \
tar -xjf pcre-$PCRE_VERSION.tar.bz2 && \
wget -q http://zlib.net/zlib-$ZLIB_VERSION.tar.gz && \
tar -xzf zlib-$ZLIB_VERSION.tar.gz && \
wget -q http://nginx.org/download/nginx-$NGNX_VERSION.tar.gz && \
tar -xzf nginx-$NGNX_VERSION.tar.gz
# Install Nginx with PCRE, OpenSSL, Geomod, Zlib
RUN set -x && \
cd /tmp/nginx-$NGNX_VERSION && \
./configure \
--with-compat \
--with-ld-opt="-static" \
--with-pcre=/tmp/pcre-${PCRE_VERSION} \
--with-zlib=/tmp/zlib-${ZLIB_VERSION} \
--with-openssl=/tmp/openssl-${OSSL_VERSION} \
--with-http_realip_module \
--with-http_v2_module \
--add-module=/tmp/ModSecurity-nginx \
--with-http_ssl_module && \
make -j 10 && \
make install && \
strip /usr/local/nginx/sbin/nginx && \
apk del general-dependencies
# Symlink access and error logs to /dev/stdout and /dev/stderr, in
# order to make use of Docker's logging mechanism
RUN ln -sf /dev/stdout /usr/local/nginx/logs/access.log && \
ln -sf /dev/stderr /usr/local/nginx/logs/error.log
RUN addgroup -S nginx && adduser -S -G nginx nginx
Failures occur during the Nginx make section. There are many similar to these.
/usr/include/c++/10.2.1/bits/basic_string.tcc:225: undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_S_copy_chars(char*, char const*, char const*)'
/usr/lib/gcc/x86_64-alpine-linux-musl/10.2.1/../../../../x86_64-alpine-linux-musl/bin/ld: /usr/include/c++/10.2.1/bits/basic_string.tcc:219: undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_create(unsigned long&, unsigned long)'
/usr/lib/gcc/x86_64-alpine-linux-musl/10.2.1/../../../../x86_64-alpine-linux-musl/bin/ld: /usr/include/c++/10.2.1/bits/basic_string.tcc:212: undefined reference to `std::__throw_logic_error(char const*)'
/usr/lib/gcc/x86_64-alpine-linux-musl/10.2.1/../../../../x86_64-alpine-linux-musl/bin/ld: /usr/local/modsecurity/lib/libmodsecurity.a(lt5-libmodsecurity_la-rule.o): in function `_GLOBAL__sub_I_rule.cc':
/usr/include/c++/10.2.1/iostream:74: undefined reference to `std::ios_base::Init::Init()'
/usr/lib/gcc/x86_64-alpine-linux-musl/10.2.1/../../../../x86_64-alpine-linux-musl/bin/ld: /usr/local/modsecurity/lib/libmodsecurity.a(lt5-libmodsecurity_la-rule.o): in function `__static_initialization_and_destruction_0':
/usr/include/c++/10.2.1/iostream:74: undefined reference to `std::ios_base::Init::~Init()'
/usr/lib/gcc/x86_64-alpine-linux-musl/10.2.1/../../../../x86_64-alpine-linux-musl/bin/ld: /usr/local/modsecurity/lib/libmodsecurity.a(lt5-libmodsecurity_la-rule.o): in function `__static_initialization_and_destruction_0':
/tmp/ModSecurity/src/variables/rule.cc:23: undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string()'
collect2: error: ld returned 1 exit status
make[1]: *** [objs/Makefile:267: objs/nginx] Error 1
OWASP ModSecurity Core Rule Set project here.
I've never attempted a static compile, but I suggest you ask the question on the modsecurity mailinglist or on the specific modsecurity developer mailinglist.
https://sourceforge.net/p/mod-security/mailman/

fatal error: json-c/json.h: No such file or directory Cross compiling on ubuntu x64 for raspberry pi arm

I am trying to compile my code on my Ubuntu x64 laptop for the Raspberry Pi.
I am able to compile and run the code on Ubuntu laptop without any issue. However when I try to compile it for Raspberry Pi I get the following error:
$make
/home/nmohan/Development/arm-bcm2708-linux-gnueabi/bin/arm-bcm2708-linux-gnueabi-gcc -g -Wall -Wextra -I /home/nmohan/github/NiRobot/inc -fPIC -shared -L/home/nmohan/github/NiRobot/Obj_arm -Wl,-rpath=/home/nmohan/github/NiRobot/Obj -o /home/nmohan/github/NiRobot/Obj_arm/libRSXA.so /home/nmohan/github/NiRobot/lib/RSXA.c -lNMT_stdlib -lNMT_log -ljson-c -lc -Ljson-c
/home/nmohan/github/NiRobot/lib/RSXA.c:11:25: fatal error: json-c/json.h: No such file or directory
compilation terminated.
Makefile:101: recipe for target '/home/nmohan/github/NiRobot/Obj_arm/libRSXA.so' failed
make: *** [/home/nmohan/github/NiRobot/Obj_arm/libRSXA.so] Error 1
#---------------------------------------#
# #
# Global Varibles #
# #
#---------------------------------------#
PROJ_DIR = /home/nmohan/github/NiRobot
BIN_DIR = $(PROJ_DIR)/bin
OBJ_DIR = $(PROJ_DIR)/Obj
OBJ_DIR_ARM = $(PROJ_DIR)/Obj_arm
INC_DIR = $(PROJ_DIR)/inc
LIB_DIR = $(PROJ_DIR)/lib
OUT_DIR = $(PROJ_DIR)/bld
OUT_DIR_ARM = $(PROJ_DIR)/bld_arm
CFLAGS = -g -Wall -Wextra -I $(INC_DIR)
SFLAGS = -fPIC -shared
RPATH = -L$(OBJ_DIR) -Wl,-rpath=$(OBJ_DIR)
RPATH_ARM = -L$(OBJ_DIR_ARM) -Wl,-rpath=$(OBJ_DIR)
GCC_DIR = /home/nmohan/Development/arm-bcm2708-linux-gnueabi/bin/arm-bcm2708-linux-gnueabi-gcc
#---------------------------------------#
# #
# Targets #
# #
#---------------------------------------#
OBJS = NMT_stdlib.so \
NMT_log.so \
RSXA.so \
PCA9685.so \
MTDR.so \
CAM_MOTOR_CTRL.so \
HCxSR04.so
#---------------------------------------#
# #
# Dependancies #
# #
#---------------------------------------#
NMT_STDLIB_LIBS = -lc
NMT_LOG_LIBS = -lc \
-lNMT_stdlib \
RSXA_LIBS = -lNMT_stdlib \
-lNMT_log \
-ljson-c \
-lc
PCA9685_LIBS = -lNMT_stdlib \
-lNMT_log \
-lc \
-lwiringPi \
-lcrypt \
-lm \
-lrt \
-lRSXA
MTDR_LIBS = -lNMT_stdlib \
-lNMT_log \
-lwiringPi \
-lPCA9685 \
-lcrypt \
-lm \
-lrt \
-lRSXA
CAM_MOTOR_CTRL_LIBS = -lNMT_stdlib \
-lNMT_log \
-lwiringPi \
-lMTDR \
-lPCA9685 \
-lcrypt \
-lm \
-lrt \
-lRSXA
HCxSR04_LIBS = -lNMT_log \
-lNMT_stdlib \
-lRSXA \
-lwiringPi \
-lcrypt \
-lm \
-lrt
TARGET_OBJS := $(foreach OBJ,$(OBJS),$(OBJ_DIR)/lib$(OBJ))
TARGET_OBJS_ARM := $(foreach OBJ,$(OBJS),$(OBJ_DIR_ARM)/lib$(OBJ))
all: $(TARGET_OBJS) \
$(TARGET_OBJS_ARM)
.PHONY: all
$(OBJ_DIR)/lib%.so: $(LIB_DIR)/%.c $(INC_DIR)/%.h
gcc $(CFLAGS) $(SFLAGS) $(RPATH) -o $# $< $($(*)_LIBS)
$(OBJ_DIR_ARM)/lib%.so: $(LIB_DIR)/%.c $(INC_DIR)/%.h
$(GCC_DIR) $(CFLAGS) $(SFLAGS) $(RPATH_ARM) -o $# $< $($(*)_LIBS)
$(OBJ_DIR)/lib%.so: $(LIB_DIR)/%.cpp $(INC_DIR)/%.hpp
g++ $(CFLAGS) $(SFLAGS) $(RPATH) -o $# $< $($(*)_LIBS)
It depends on json-c/json.h. You need to include these files that were not found.
Installing libjson-c-dev package.
sudo apt install libjson-c-dev
I've had a similar problem. It's because of the json.h which is not part of the, in my case, gcc-arm-10-3-2017.07...-aarch64-none-linux-gnu.
I simply cloned json-c git and compiled it with the cross-compiler, too. Then you can reference to the output, or you can inlcude the whole git into your project and compile it all in one.

Error "undefined reference to `cprintf''" during executing make command in qemu in linux kernel

(1) This is the main function (runproctest.c):
#include "defs.h"
void
runproctest(void)
{
cprintf("testing runnable: test1\n");
}
(2) defs.h:
// console.c
void cprintf(char*, ...);
(3) console.c
#include "defs.h"
void
cprintf(char *fmt, ...)
{
int i, c, locking;
uint *argp;
char *s;
locking = cons.locking;
if(locking)
acquire(&cons.lock);
if (fmt == 0)
...
}
(4) main.c
#include "types.h"
#include "defs.h"
#include "param.h"
#include "memlayout.h"
#include "mmu.h"
#include "proc.h"
#include "x86.h"
static void startothers(void);
static void mpmain(void) __attribute__((noreturn));
extern pde_t *kpgdir;
extern char end[]; // first address after kernel loaded from ELF file
// Bootstrap processor starts running C code here.
// Allocate a real stack and switch to it, first
// doing some setup required for memory allocator to work.
int
main(void)
{
kinit1(end, P2V(4*1024*1024)); // phys page allocator
kvmalloc(); // kernel page table
mpinit(); // detect other processors
lapicinit(); // interrupt controller
seginit(); // segment descriptors
cprintf("\ncpu%d: starting xv6\n\n", cpunum());
picinit(); // another interrupt controller
ioapicinit(); // another interrupt controller
consoleinit(); // console hardware
uartinit(); // serial port
pinit(); // process table
tvinit(); // trap vectors
binit(); // buffer cache
fileinit(); // file table
ideinit(); // disk
if(!ismp)
timerinit(); // uniprocessor timer
startothers(); // start other processors
kinit2(P2V(4*1024*1024), P2V(PHYSTOP)); // must come after startothers()
userinit(); // first user process
mpmain(); // finish this processor's setup
}
// Other CPUs jump here from entryother.S.
static void
mpenter(void)
{
switchkvm();
seginit();
lapicinit();
mpmain();
}
// Common CPU setup code.
static void
mpmain(void)
{
cprintf("cpu%d: starting\n", cpunum());
idtinit(); // load idt register
xchg(&cpu->started, 1); // tell startothers() we're up
scheduler(); // start running processes
}
pde_t entrypgdir[]; // For entry.S
// Start the non-boot (AP) processors.
static void
startothers(void)
{
extern uchar _binary_entryother_start[], _binary_entryother_size[];
uchar *code;
struct cpu *c;
char *stack;
// Write entry code to unused memory at 0x7000.
// The linker has placed the image of entryother.S in
// _binary_entryother_start.
code = P2V(0x7000);
memmove(code, _binary_entryother_start, (uint)_binary_entryother_size);
for(c = cpus; c < cpus+ncpu; c++){
if(c == cpus+cpunum()) // We've started already.
continue;
// Tell entryother.S what stack to use, where to enter, and what
// pgdir to use. We cannot use kpgdir yet, because the AP processor
// is running in low memory, so we use entrypgdir for the APs too.
stack = kalloc();
*(void**)(code-4) = stack + KSTACKSIZE;
*(void**)(code-8) = mpenter;
*(int**)(code-12) = (void *) V2P(entrypgdir);
lapicstartap(c->apicid, V2P(code));
// wait for cpu to finish mpmain()
while(c->started == 0)
;
}
}
// The boot page table used in entry.S and entryother.S.
// Page directories (and page tables) must start on page boundaries,
// hence the __aligned__ attribute.
// PTE_PS in a page directory entry enables 4Mbyte pages.
__attribute__((__aligned__(PGSIZE)))
pde_t entrypgdir[NPDENTRIES] = {
// Map VA's [0, 4MB) to PA's [0, 4MB)
[0] = (0) | PTE_P | PTE_W | PTE_PS,
// Map VA's [KERNBASE, KERNBASE+4MB) to PA's [0, 4MB)
[KERNBASE>>PDXSHIFT] = (0) | PTE_P | PTE_W | PTE_PS,
};
(5) Here is my Makefile:
OBJS = \
bio.o\
console.o\
exec.o\
file.o\
fs.o\
ide.o\
ioapic.o\
kalloc.o\
kbd.o\
lapic.o\
log.o\
main.o\
mp.o\
picirq.o\
pipe.o\
proc.o\
spinlock.o\
string.o\
swtch.o\
syscall.o\
sysfile.o\
sysproc.o\
timer.o\
trapasm.o\
trap.o\
uart.o\
vectors.o\
vm.o\
runproctest.o\
# Cross-compiling (e.g., on Mac OS X)
# TOOLPREFIX = i386-jos-elf
# Using native tools (e.g., on X86 Linux)
#TOOLPREFIX =
# Try to infer the correct TOOLPREFIX if not set
ifndef TOOLPREFIX
TOOLPREFIX := $(shell if i386-jos-elf-objdump -i 2>&1 | grep '^elf32-i386$$' >/dev/null 2>&1; \
then echo 'i386-jos-elf-'; \
elif objdump -i 2>&1 | grep 'elf32-i386' >/dev/null 2>&1; \
then echo ''; \
else echo "***" 1>&2; \
echo "*** Error: Couldn't find an i386-*-elf version of GCC/binutils." 1>&2; \
echo "*** Is the directory with i386-jos-elf-gcc in your PATH?" 1>&2; \
echo "*** If your i386-*-elf toolchain is installed with a command" 1>&2; \
echo "*** prefix other than 'i386-jos-elf-', set your TOOLPREFIX" 1>&2; \
echo "*** environment variable to that prefix and run 'make' again." 1>&2; \
echo "*** To turn off this error, run 'gmake TOOLPREFIX= ...'." 1>&2; \
echo "***" 1>&2; exit 1; fi)
endif
# If the makefile can't find QEMU, specify its path here
QEMU = /home/yuanzheng/Qemu_installed/bin/qemu-system-i386
# Try to infer the correct QEMU
ifndef QEMU
QEMU = $(shell if which qemu > /dev/null; \
then echo qemu; exit; \
elif which qemu-system-i386 > /dev/null; \
then echo qemu-system-i386; exit; \
else \
qemu=/Applications/Q.app/Contents/MacOS/i386-softmmu.app/Contents/MacOS/i386-softmmu; \
if test -x $$qemu; then echo $$qemu; exit; fi; fi; \
echo "***" 1>&2; \
echo "*** Error: Couldn't find a working QEMU executable." 1>&2; \
echo "*** Is the directory containing the qemu binary in your PATH" 1>&2; \
echo "*** or have you tried setting the QEMU variable in Makefile?" 1>&2; \
echo "***" 1>&2; exit 1)
endif
CC = $(TOOLPREFIX)gcc
AS = $(TOOLPREFIX)gas
LD = $(TOOLPREFIX)ld
OBJCOPY = $(TOOLPREFIX)objcopy
OBJDUMP = $(TOOLPREFIX)objdump
CFLAGS = -fno-pic -static -fno-builtin -fno-strict-aliasing -O2 -Wall -MD -ggdb -m32 -Werror -fno-omit-frame-pointer
#CFLAGS = -fno-pic -static -fno-builtin -fno-strict-aliasing -fvar-tracking -fvar-tracking-assignments -O0 -g -Wall -MD -gdwarf-2 -m32 -Werror -fno-omit-frame-pointer
CFLAGS += $(shell $(CC) -fno-stack-protector -E -x c /dev/null >/dev/null 2>&1 && echo -fno-stack-protector)
ASFLAGS = -m32 -gdwarf-2 -Wa,-divide
# FreeBSD ld wants ``elf_i386_fbsd''
LDFLAGS += -m $(shell $(LD) -V | grep elf_i386 2>/dev/null)
xv6.img: bootblock kernel fs.img
dd if=/dev/zero of=xv6.img count=10000
dd if=bootblock of=xv6.img conv=notrunc
dd if=kernel of=xv6.img seek=1 conv=notrunc
xv6memfs.img: bootblock kernelmemfs
dd if=/dev/zero of=xv6memfs.img count=10000
dd if=bootblock of=xv6memfs.img conv=notrunc
dd if=kernelmemfs of=xv6memfs.img seek=1 conv=notrunc
bootblock: bootasm.S bootmain.c
$(CC) $(CFLAGS) -fno-pic -O -nostdinc -I. -c bootmain.c
$(CC) $(CFLAGS) -fno-pic -nostdinc -I. -c bootasm.S
$(LD) $(LDFLAGS) -N -e start -Ttext 0x7C00 -o bootblock.o bootasm.o bootmain.o
$(OBJDUMP) -S bootblock.o > bootblock.asm
$(OBJCOPY) -S -O binary -j .text bootblock.o bootblock
./sign.pl bootblock
entryother: entryother.S
$(CC) $(CFLAGS) -fno-pic -nostdinc -I. -c entryother.S
$(LD) $(LDFLAGS) -N -e start -Ttext 0x7000 -o bootblockother.o entryother.o
$(OBJCOPY) -S -O binary -j .text bootblockother.o entryother
$(OBJDUMP) -S bootblockother.o > entryother.asm
initcode: initcode.S
$(CC) $(CFLAGS) -nostdinc -I. -c initcode.S
$(LD) $(LDFLAGS) -N -e start -Ttext 0 -o initcode.out initcode.o
$(OBJCOPY) -S -O binary initcode.out initcode
$(OBJDUMP) -S initcode.o > initcode.asm
kernel: $(OBJS) entry.o entryother initcode kernel.ld
$(LD) $(LDFLAGS) -T kernel.ld -o kernel entry.o $(OBJS) -b binary initcode entryother
$(OBJDUMP) -S kernel > kernel.asm
$(OBJDUMP) -t kernel | sed '1,/SYMBOL TABLE/d; s/ .* / /; /^$$/d' > kernel.sym
# kernelmemfs is a copy of kernel that maintains the
# disk image in memory instead of writing to a disk.
# This is not so useful for testing persistent storage or
# exploring disk buffering implementations, but it is
# great for testing the kernel on real hardware without
# needing a scratch disk.
MEMFSOBJS = $(filter-out ide.o,$(OBJS)) memide.o
kernelmemfs: $(MEMFSOBJS) entry.o entryother initcode kernel.ld fs.img
$(LD) $(LDFLAGS) -T kernel.ld -o kernelmemfs entry.o $(MEMFSOBJS) -b binary initcode entryother fs.img
$(OBJDUMP) -S kernelmemfs > kernelmemfs.asm
$(OBJDUMP) -t kernelmemfs | sed '1,/SYMBOL TABLE/d; s/ .* / /; /^$$/d' > kernelmemfs.sym
tags: $(OBJS) entryother.S _init
etags *.S *.c
vectors.S: vectors.pl
perl vectors.pl > vectors.S
ULIB = ulib.o usys.o printf.o umalloc.o
_%: %.o $(ULIB)
$(LD) $(LDFLAGS) -N -e main -Ttext 0 -o $# $^
$(OBJDUMP) -S $# > $*.asm
$(OBJDUMP) -t $# | sed '1,/SYMBOL TABLE/d; s/ .* / /; /^$$/d' > $*.sym
_forktest: forktest.o $(ULIB)
# forktest has less library code linked in - needs to be small
# in order to be able to max out the proc table.
$(LD) $(LDFLAGS) -N -e main -Ttext 0 -o _forktest forktest.o ulib.o usys.o
$(OBJDUMP) -S _forktest > forktest.asm
mkfs: mkfs.c fs.h
gcc -Werror -Wall -o mkfs mkfs.c
# Prevent deletion of intermediate files, e.g. cat.o, after first build, so
# that disk image changes after first build are persistent until clean. More
# details:
# http://www.gnu.org/software/make/manual/html_node/Chained-Rules.html
.PRECIOUS: %.o
UPROGS=\
_cat\
_echo\
_forktest\
_grep\
_init\
_kill\
_ln\
_ls\
_mkdir\
_rm\
_sh\
_stressfs\
_usertests\
_wc\
_zombie\
_runnable\
_runnabletest\
_runproctest\
fs.img: mkfs README $(UPROGS)
./mkfs fs.img README $(UPROGS)
-include *.d
clean:
rm -f *.tex *.dvi *.idx *.aux *.log *.ind *.ilg \
*.o *.d *.asm *.sym vectors.S bootblock entryother \
initcode initcode.out kernel xv6.img fs.img kernelmemfs mkfs \
.gdbinit \
$(UPROGS)
# make a printout
FILES = $(shell grep -v '^\#' runoff.list)
PRINT = runoff.list runoff.spec README toc.hdr toc.ftr $(FILES)
xv6.pdf: $(PRINT)
./runoff
ls -l xv6.pdf
print: xv6.pdf
# run in emulators
bochs : fs.img xv6.img
if [ ! -e .bochsrc ]; then ln -s dot-bochsrc .bochsrc; fi
bochs -q
# try to generate a unique GDB port
GDBPORT = $(shell expr `id -u` % 5000 + 25000)
# QEMU's gdb stub command line changed in 0.11
QEMUGDB = $(shell if $(QEMU) -help | grep -q '^-gdb'; \
then echo "-gdb tcp::$(GDBPORT)"; \
else echo "-s -p $(GDBPORT)"; fi)
ifndef CPUS
CPUS := 2
endif
QEMUOPTS = -drive file=fs.img,index=1,media=disk,format=raw -drive file=xv6.img,index=0,media=disk,format=raw -smp $(CPUS) -m 512 $(QEMUEXTRA)
qemu: fs.img xv6.img
$(QEMU) -serial mon:stdio $(QEMUOPTS)
qemu-memfs: xv6memfs.img
$(QEMU) -drive file=xv6memfs.img,index=0,media=disk,format=raw -smp $(CPUS) -m 256
qemu-nox: fs.img xv6.img
$(QEMU) -nographic $(QEMUOPTS)
.gdbinit: .gdbinit.tmpl
sed "s/localhost:1234/localhost:$(GDBPORT)/" < $^ > $#
qemu-gdb: fs.img xv6.img .gdbinit
#echo "*** Now run 'gdb'." 1>&2
$(QEMU) -serial mon:stdio $(QEMUOPTS) -S $(QEMUGDB)
qemu-nox-gdb: fs.img xv6.img .gdbinit
#echo "*** Now run 'gdb'." 1>&2
$(QEMU) -nographic $(QEMUOPTS) -S $(QEMUGDB)
# CUT HERE
# prepare dist for students
# after running make dist, probably want to
# rename it to rev0 or rev1 or so on and then
# check in that version.
EXTRA=\
mkfs.c ulib.c user.h cat.c echo.c forktest.c grep.c kill.c\
ln.c ls.c mkdir.c rm.c stressfs.c usertests.c wc.c zombie.c\
printf.c umalloc.c runnable.c printf.h runnabletest.c runproctest.c\
README dot-bochsrc *.pl toc.* runoff runoff1 runoff.list\
.gdbinit.tmpl gdbutil\
dist:
rm -rf dist
mkdir dist
for i in $(FILES); \
do \
grep -v PAGEBREAK $$i >dist/$$i; \
done
sed '/CUT HERE/,$$d' Makefile >dist/Makefile
echo >dist/runoff.spec
cp $(EXTRA) dist
dist-test:
rm -rf dist
make dist
rm -rf dist-test
mkdir dist-test
cp dist/* dist-test
cd dist-test; $(MAKE) print
cd dist-test; $(MAKE) bochs || true
cd dist-test; $(MAKE) qemu
# update this rule (change rev#) when it is time to
# make a new revision.
tar:
rm -rf /tmp/xv6
mkdir -p /tmp/xv6
cp dist/* dist/.gdbinit.tmpl /tmp/xv6
(cd /tmp; tar cf - xv6) | gzip >xv6-rev9.tar.gz # the next one will be 9 (6/27/15)
.PHONY: dist-test dist
and when I enter make qemu there is a problem:
yuanzheng#ubuntu:~/Operating_System/xv6_sourcecode/xv6-public$ make qemu
ld -m elf_i386 -N -e main -Ttext 0 -o _runproctest runproctest.o ulib.o usys.o printf.o umalloc.o
ld: warning: cannot find entry symbol main; defaulting to 0000000000000000
runproctest.o: In function `runproctest':
/home/yuanzheng/Operating_System/xv6_sourcecode/xv6-public/runproctest.c:26: undefined reference to `cprintf'
Makefile:141: recipe for target '_runproctest' failed
make: *** [_runproctest] Error 1
I don't know why this happens..
in the makefile, this line:
ld -m elf_i386 -N -e main -Ttext 0 -o _runproctest runproctest.o ulib.o usys.o printf.o umalloc.o
should be:
ld -m elf_i386 -N -e main -Ttext 0 -o _runproctest runproctest.o ulib.o usys.o printf.o umalloc.o console.o
There may be other ld commands in the make file with similar problems.
Also, per the error messages, there is no main() function anywhere in the files used to create the _runproctest executable. That is (usually) a strong indication that the code will not properly execute.
As an aside:
a name that begins with __ or _ followed by a capital letter are reserved for the environment.
Naming your own items with a leading underscore (probably) will work, but it is cluttering the environment name space. Strongly suggest not using any leading _ in your names

More advanced makefile

I am currently creating (well at least I'm trying) to create a makefile for a software project.
Since I never used make before I quickly ran into problems.
The software project contains of many subfolders and subsubfolders containing source and header files.
Those files should be collected recursivly and after that beeing build and linked using cross arm toolchain.
The current makefile looks as following:
RM := rm -rf
# Every subdirectory with source files must be described here
DIR := \
D:/foxmake/
SUBDIRS := \
src/test \
src/test/usb_cdc_lolevel \
src/os \
src/os/FreeRTOS/Source \
src/os/FreeRTOS/Source/portable/MemMang \
src/os/FreeRTOS/Source/portable/GCC/ARM_CM4F \
src/os/FreeRTOS/Source/CMSIS_RTOS \
src/module/uart \
src/module/spi \
src/module/rcc \
src/module/ltc \
src/module/irq \
src/module/io \
src/module/eeprom \
src/module/dma \
src/module/cpu \
src/module/contactor \
src/module/config \
src/module/com \
src/module/can \
src/module/adc \
src/hal/STM32F4xx_HAL_Driver/Src \
src/general \
src/general/config \
src/engine/task \
src/engine/sysctrl \
src/engine/sof \
src/engine/soc \
src/engine/isoguard \
src/engine/diag \
src/engine/database \
src/engine/config \
src/application/task \
src/application/config \
CFLAGS := \
-mcpu=cortex-m4 \
-mthumb -mlittle-endian \
-mfloat-abi=softfp \
-mfpu=fpv4-sp-d16 \
-O0 \
-fmessage-length=0 \
-fsigned-char \
-ffunction-sections \
-fdata-sections \
-ffreestanding \
-fno-move-loop-invariants \
-Wall \
-g3 \
-std=gnu11 \
-DSTM32F429xx \
-DDEBUG \
-DUSE_FULL_ASSERT \
-DTRACE \
-DOS_USE_TRACE_ITM \
-DUSE_HAL_DRIVER \
-DHSE_VALUE=8000000
INCDIRS := \
-I"D:/foxmake/src/application" \
-I"D:/foxmake/src/application/config" \
-I"D:/foxmake/src/application/task" \
-I"D:/foxmake/src/module/adc" \
-I"D:/foxmake/src/module/can" \
-I"D:/foxmake/src/module/com" \
-I"D:/foxmake/src/module/config" \
-I"D:/foxmake/src/module/contactor" \
-I"D:/foxmake/src/module/cpuload" \
-I"D:/foxmake/src/module/io" \
-I"D:/foxmake/src/module/ltc" \
-I"D:/foxmake/src/module/spi" \
-I"D:/foxmake/src/module/uart" \
-I"D:/foxmake/src/engine/config" \
-I"D:/foxmake/src/engine/database" \
-I"D:/foxmake/src/engine/diag" \
-I"D:/foxmake/src/engine/isoguard" \
-I"D:/foxmake/src/engine/soc" \
-I"D:/foxmake/src/engine/sof" \
-I"D:/foxmake/src/engine/sysctrl" \
-I"D:/foxmake/src/engine/task" \
-I"D:/foxmake/src/general" \
-I"D:/foxmake/src/general/config" \
-I"D:/foxmake/src/general/includes" \
-I"D:/foxmake/src/hal/CMSIS/Device/ST/STM32F4xx/Include" \
-I"D:/foxmake/src/hal/CMSIS/Include" \
-I"D:/foxmake/src/hal/STM32F4xx_HAL_Driver/Inc" \
-I"D:/foxmake/src/os" \
-I"D:/foxmake/src/os/FreeRTOS" \
-I"D:/foxmake/src/os/FreeRTOS/Source" \
-I"D:/foxmake/src/os/FreeRTOS/Source/include" \
-I"D:/foxmake/src/os/FreeRTOS/Source/CMSIS_RTOS" \
-I"D:/foxmake/src/os/FreeRTOS/Source/portable/GCC/ARM_CM4F" \
-I"D:/foxmake/src/test" \
-I"D:/foxmake/src/module/cpu" \
-I"D:/foxmake/src/module/dma" \
-I"D:/foxmake/src/module/irq" \
-I"D:/foxmake/src/module/rcc" \
-I"D:/foxmake/src/test/usb_cdc_lolevel"
S_UPPER_SRCS := \
$(DIR)src/general/config/startup_stm32f429xx.S
S_UPPER_DEPS := \
./src/general/config/startup_stm32f429xx.d
rwildcard = $(foreach d,$(wildcard $1*),$(call rwildcard,$d/,$2) $(filter $(subst *,%,$2),$d))
# All of the sources participating in the build are defined here
C_SRCS := \
$(call rwildcard, , *.c)
#$(info C_SRCS='$(C_SRCS)')
OBJDIR := objdir
OBJS := \
$(patsubst %.c,%.o,$(C_SRCS))
#$(error OBJS='$(OBJS)')
# comment the above line once OBJS is ok.
C_DEPS := \
$(patsubst %.c,%.d,$(C_SRCS))
#$(info C_DEPS='$(C_DEPS)')
%.o: %.c ,$(C_SRCS)
echo 'Building file: $<'
echo 'Invoking: Cross ARM C Compiler'
arm-none-eabi-gcc $(CFLAGS) $(INCDIRS) -MMD -MP -MF"$(#:%.o=%.d)" -MT"$#" -c -o "$#" "$<"
echo 'Finished building: $<'
echo ' '
ifneq ($(MAKECMDGOALS),clean)
ifneq ($(strip $(CC_DEPS)),)
-include $(CC_DEPS)
endif
ifneq ($(strip $(C++_DEPS)),)
-include $(C++_DEPS)
endif
ifneq ($(strip $(C_UPPER_DEPS)),)
-include $(C_UPPER_DEPS)
endif
ifneq ($(strip $(CXX_DEPS)),)
-include $(CXX_DEPS)
endif
ifneq ($(strip $(ASM_DEPS)),)
-include $(ASM_DEPS)
endif
ifneq ($(strip $(S_UPPER_DEPS)),)
-include $(S_UPPER_DEPS)
endif
ifneq ($(strip $(C_DEPS)),)
-include $(C_DEPS)
endif
ifneq ($(strip $(CPP_DEPS)),)
-include $(CPP_DEPS)
endif
endif
# Add inputs and outputs from these tool invocations to the build variables
SECONDARY_FLASH := \
foxbms.hex \
SECONDARY_LIST := \
foxbms.lst \
SECONDARY_SIZE := \
foxbms.siz \
# All Target
all: foxbms.elf secondary-outputs
# Tool invocations
foxbms.elf: $(OBJS) $(USER_OBJS)
#echo 'Building target: $#'
#echo 'Invoking: Cross ARM C++ Linker'
arm-none-eabi-g++ -mcpu=cortex-m4 -mthumb -mlittle-endian -mfloat-abi=softfp -mfpu=fpv4-sp-d16 -O0 -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -ffreestanding -fno-move-loop-invariants -Wall -g3 -T "D:/foxmake/src/STM32F429ZIT6_FLASH.ld" -Xlinker --gc-sections -Wl,-Map,"foxbms.map" --specs=nano.specs -o "foxbms.elf" $(OBJS) $(USER_OBJS) $(LIBS)
#echo 'Finished building target: $#'
#echo ' '
$(MAKE) --no-print-directory post-build
foxbms.hex: foxbms.elf
#echo 'Invoking: Cross ARM GNU Create Flash Image'
arm-none-eabi-objcopy -O ihex "foxbms.elf" "foxbms.hex"
#echo 'Finished building: $#'
#echo ' '
foxbms.lst: foxbms.elf
#echo 'Invoking: Cross ARM GNU Create Listing'
arm-none-eabi-objdump --source --all-headers --demangle --line-numbers --wide "foxbms.elf" > "foxbms.lst"
#echo 'Finished building: $#'
#echo ' '
foxbms.siz: foxbms.elf
#echo 'Invoking: Cross ARM GNU Print Size'
arm-none-eabi-size --format=berkeley $(OBJS) "foxbms.elf"
#echo 'Finished building: $#'
#echo ' '
# Other Targets
clean:
-$(RM) \
$(CC_DEPS) \
$(C++_DEPS) \
$(OBJS) \
$(C_UPPER_DEPS) \
$(CXX_DEPS) \
$(SECONDARY_FLASH) \
$(SECONDARY_LIST) \
$(SECONDARY_SIZE) \
$(ASM_DEPS) \
$(S_UPPER_DEPS) \
$(C_DEPS) \
$(CPP_DEPS) \
foxbms.elf
-#echo ' '
post-build:
-#echo 'Create binary'
-arm-none-eabi-objcopy -O binary "foxbms.elf" "foxbms.bin"
-#echo ' '
secondary-outputs: $(SECONDARY_FLASH) $(SECONDARY_LIST) $(SECONDARY_SIZE)
.PHONY: all clean dependents x
.SECONDARY: post-build
using eclipse to execute this makefile gives me this error:
make all
cc -mcpu=cortex-m4 -mthumb -mlittle-endian -mfloat-abi=softfp -mfpu=fpv4-sp-d16 -O0 -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -ffreestanding -fno-move-loop-invariants -Wall -g3 -std=gnu11 -DSTM32F429xx -DDEBUG -DUSE_FULL_ASSERT -DTRACE -DOS_USE_TRACE_ITM -DUSE_HAL_DRIVER -DHSE_VALUE=8000000 -c -o src/general/nvic.o src/general/nvic.c
<builtin>: recipe for target 'src/general/nvic.o' failed
process_begin: CreateProcess(NULL, cc -mcpu=cortex-m4 -mthumb -mlittle-endian -mfloat-abi=softfp -mfpu=fpv4-sp-d16 -O0 -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -ffreestanding -fno-move-loop-invariants -Wall -g3 -std=gnu11 -DSTM32F429xx -DDEBUG -DUSE_FULL_ASSERT -DTRACE -DOS_USE_TRACE_ITM -DUSE_HAL_DRIVER -DHSE_VALUE=8000000 -c -o src/general/nvic.o src/general/nvic.c, ...) failed.
make (e=2): System is unable to find the given file.
make: *** [src/general/nvic.o] Error 2
Anyone knows why my makefile fails?
What's wrong with the rule "%.o: %.c ,$(C_SRCS)"?

adding new file to C project using Makefile

I am trynig to add new file to source code of an open-source software called snort in order to extend it. This project is based on Makefile and I use the netbeans IDE. I want to add my file named my_new_file.h & my_new_file.c to this project. I investigated the Makefile and added the name of my files to the end of lists of source files and object files wherever I saw; that you can see simply by searching my_new_file in this page(ctrl+F). After this the project is built fine; but when I want to run the software I see the error stating that the definition of new function I defined in my_new_file not found.
/libsf_sip_preproc.so: undefined symbol: my_new_func
All of this package is going to be compiled and linked into some shared object files. I see the object file of my sources are generated but I think they didn't link correctly into the makefile. The mekefile I use is auto-generated by mixing makefile.in & makefile.am using the configure script. I attached the whole main makefile bellow. If somebody knows how can I edit this makefile to compile and link my sources to the main project I will be so thankful.
This Is the make.am file:
## $Id
AUTOMAKE_OPTIONS=foreign no-dependencies
INCLUDES = -I../include -I${srcdir}/../libs -I$(srcdir)/includes
libdir = ${exec_prefix}/lib/snort_dynamicpreprocessor
lib_LTLIBRARIES = libsf_sip_preproc.la
libsf_sip_preproc_la_LDFLAGS = -shared -export-dynamic -module #XCCFLAGS#
if SO_WITH_STATIC_LIB
libsf_sip_preproc_la_LIBADD = ../libsf_dynamic_preproc.la
else
nodist_libsf_sip_preproc_la_SOURCES = \
../include/sf_dynamic_preproc_lib.c \
../include/sf_ip.c \
../include/sfPolicyUserData.c
endif
libsf_sip_preproc_la_SOURCES = \
spp_sip.c \
spp_sip.h \
sip_config.c \
sip_config.h \
sip_parser.c \
sip_parser.h \
sip_dialog.c \
sip_dialog.h \
sip_roptions.c \
sip_roptions.h \
sip_utils.c \
sip_utils.h \
sip_debug.h \
my_new_file.c \
my_new_file.h
EXTRA_DIST = \
sf_sip.dsp
all-local: $(LTLIBRARIES)
$(MAKE) DESTDIR=`pwd`/../build install-libLTLIBRARIES
and this is the main Maikefile generated using makefile.am and makefile.in by configure script:
# Makefile.in generated by automake 1.11.1 from Makefile.am.
# src/dynamic-preprocessors/sip/Makefile. Generated from Makefile.in by configure.
pkgdatadir = $(datadir)/snort
pkgincludedir = $(includedir)/snort
pkglibdir = $(libdir)/snort
pkglibexecdir = $(libexecdir)/snort
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = i686-pc-linux-gnu
host_triplet = i686-pc-linux-gnu
subdir = src/dynamic-preprocessors/sip
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/libprelude.m4 \
$(top_srcdir)/configure.in
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
am__vpath_adj = case $$p in \
$(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
*) f=$$p;; \
esac;
am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
am__install_max = 40
am__nobase_strip_setup = \
srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
am__nobase_strip = \
for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
am__nobase_list = $(am__nobase_strip_setup); \
for p in $$list; do echo "$$p $$p"; done | \
sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
$(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
if (++n[$$2] == $(am__install_max)) \
{ print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
END { for (dir in files) print dir, files[dir] }'
am__base_list = \
sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
am__installdirs = "$(DESTDIR)$(libdir)"
LTLIBRARIES = $(lib_LTLIBRARIES)
libsf_sip_preproc_la_DEPENDENCIES = \
../libsf_dynamic_preproc.la
am_libsf_sip_preproc_la_OBJECTS = spp_sip.lo sip_config.lo \
sip_parser.lo sip_dialog.lo sip_roptions.lo sip_utils.lo \
my_new_file.lo
#nodist_libsf_sip_preproc_la_OBJECTS = \
# sf_dynamic_preproc_lib.lo sf_ip.lo \
# sfPolicyUserData.lo
libsf_sip_preproc_la_OBJECTS = $(am_libsf_sip_preproc_la_OBJECTS) \
$(nodist_libsf_sip_preproc_la_OBJECTS)
libsf_sip_preproc_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(libsf_sip_preproc_la_LDFLAGS) $(LDFLAGS) -o $#
DEFAULT_INCLUDES = -I. -I$(top_builddir)
depcomp =
am__depfiles_maybe =
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
--mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
CCLD = $(CC)
LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
$(LDFLAGS) -o $#
SOURCES = $(libsf_sip_preproc_la_SOURCES) \
$(nodist_libsf_sip_preproc_la_SOURCES)
DIST_SOURCES = $(libsf_sip_preproc_la_SOURCES)
ETAGS = etags
CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = ${SHELL} /usr/local/src/snort-2.9.2.2/missing --run aclocal-1.11
AMTAR = ${SHELL} /usr/local/src/snort-2.9.2.2/missing --run tar
AR = ar
AUTOCONF = ${SHELL} /usr/local/src/snort-2.9.2.2/missing --run autoconf
AUTOHEADER = ${SHELL} /usr/local/src/snort-2.9.2.2/missing --run autoheader
AUTOMAKE = ${SHELL} /usr/local/src/snort-2.9.2.2/missing --run automake-1.11
AWK = mawk
CC = /usr/bin/gcc
CCDEPMODE = depmode=gcc3
CCONFIGFLAGS = -DSF_VISIBILITY -fvisibility=hidden
CFLAGS = -g3 -gdwarf-2 -DSF_VISIBILITY -fvisibility=hidden -fno-strict-aliasing -Wall
CONFIGFLAGS = -DSF_WCHAR -DSUP_IP6 -DTARGET_BASED -DPERF_PROFILING -DSNORT_RELOAD -DNORMALIZER -DACTIVE_RESPONSE
CPP = /usr/bin/gcc -E
CPPFLAGS = -I/usr/local/include -DDYNAMIC_PLUGIN -I/usr/local/include -DZLIB -DGRE -DMPLS -DPREPROCESSOR_AND_DECODER_RULE_EVENTS -DPPM_MGR -DENABLE_PAF -DENABLE_REACT -DENABLE_RESPOND -DENABLE_RESPONSE3 -DSF_WCHAR -DSUP_IP6 -DTARGET_BASED -DPERF_PROFILING -DSNORT_RELOAD -DNORMALIZER -DACTIVE_RESPONSE
CYGPATH_W = echo
DEFS = -DHAVE_CONFIG_H
DEPDIR = .deps
DLLTOOL = false
DSYMUTIL =
DUMPBIN =
ECHO_C =
ECHO_N = -n
ECHO_T =
EGREP = /bin/grep -E
EXEEXT =
FGREP = /bin/grep -F
GREP = /bin/grep
ICONFIGFLAGS =
INCLUDES = -I../include -I${srcdir}/../libs -I$(srcdir)/includes
INSTALL = /usr/bin/install -c
INSTALL_DATA = ${INSTALL} -m 644
INSTALL_PROGRAM = ${INSTALL}
INSTALL_SCRIPT = ${INSTALL}
INSTALL_STRIP_PROGRAM = $(install_sh) -c -s
LD = /usr/bin/ld
LDFLAGS = -L/usr/local/lib -lpcre -L/usr/local/lib -ldnet
LEX = flex
LIBOBJS =
LIBPRELUDE_CFLAGS =
LIBPRELUDE_CONFIG =
LIBPRELUDE_CONFIG_PREFIX =
LIBPRELUDE_LDFLAGS =
LIBPRELUDE_LIBS =
LIBPRELUDE_PREFIX =
LIBPRELUDE_PTHREAD_CFLAGS =
LIBS = -lz -ldaq_static -ldnet -lpcre -lpcap -lnsl -lm -lm -ldl -L/usr/local/lib -ldaq_static_modules -lsfbpf -lpcap -lsfbpf -lpcap -lz -lpthread -lpthread -lpthread
LIBTOOL = $(SHELL) $(top_builddir)/libtool
LIPO =
LN_S = ln -s
LTLIBOBJS =
MAINT = #
MAKEINFO = ${SHELL} /usr/local/src/snort-2.9.2.2/missing --run makeinfo
MANIFEST_TOOL = :
MKDIR_P = /bin/mkdir -p
NM = /usr/bin/nm -B
NMEDIT =
OBJDUMP = objdump
OBJEXT = o
OTOOL =
OTOOL64 =
PACKAGE = snort
PACKAGE_BUGREPORT =
PACKAGE_NAME =
PACKAGE_STRING =
PACKAGE_TARNAME =
PACKAGE_URL =
PACKAGE_VERSION =
PATH_SEPARATOR = :
PKG_CONFIG =
PKG_CONFIG_LIBDIR =
PKG_CONFIG_PATH = NONE/lib/pkgconfig:
RANLIB = ranlib
RAZORBACK_CFLAGS =
RAZORBACK_LIBS =
SED = /bin/sed
SET_MAKE =
SHELL = /bin/bash
SIGNAL_SNORT_DUMP_STATS =
SIGNAL_SNORT_READ_ATTR_TBL =
SIGNAL_SNORT_RELOAD =
SIGNAL_SNORT_ROTATE_STATS =
STRIP = strip
VERSION = 2.9.2.2
XCCFLAGS =
YACC = bison -y
abs_builddir = /usr/local/src/snort-2.9.2.2/src/dynamic-preprocessors/sip
abs_srcdir = /usr/local/src/snort-2.9.2.2/src/dynamic-preprocessors/sip
abs_top_builddir = /usr/local/src/snort-2.9.2.2
abs_top_srcdir = /usr/local/src/snort-2.9.2.2
ac_ct_AR = ar
ac_ct_CC = /usr/bin/gcc
ac_ct_DUMPBIN =
am__include = include
am__leading_dot = .
am__quote =
am__tar = ${AMTAR} chof - "$$tardir"
am__untar = ${AMTAR} xf -
bindir = ${exec_prefix}/bin
build = i686-pc-linux-gnu
build_alias =
build_cpu = i686
build_os = linux-gnu
build_vendor = pc
builddir = .
datadir = ${datarootdir}
datarootdir = ${prefix}/share
docdir = ${datarootdir}/doc/${PACKAGE}
dvidir = ${docdir}
exec_prefix = ${prefix}
extra_incl = -I/usr/include/pcap
host = i686-pc-linux-gnu
host_alias =
host_cpu = i686
host_os = linux-gnu
host_vendor = pc
htmldir = ${docdir}
includedir = ${prefix}/include
infodir = ${datarootdir}/info
install_sh = ${SHELL} /usr/local/src/snort-2.9.2.2/install-sh
libdir = ${exec_prefix}/lib/snort_dynamicpreprocessor
libexecdir = ${exec_prefix}/libexec
localedir = ${datarootdir}/locale
localstatedir = ${prefix}/var
mandir = ${datarootdir}/man
mkdir_p = /bin/mkdir -p
oldincludedir = /usr/include
pdfdir = ${docdir}
prefix = /usr/local
program_transform_name = s,x,x,
psdir = ${docdir}
sbindir = ${exec_prefix}/sbin
sharedstatedir = ${prefix}/com
srcdir = .
sysconfdir = ${prefix}/etc
target_alias =
top_build_prefix = ../../../
top_builddir = ../../..
top_srcdir = ../../..
AUTOMAKE_OPTIONS = foreign no-dependencies
lib_LTLIBRARIES = libsf_sip_preproc.la
libsf_sip_preproc_la_LDFLAGS = -shared -export-dynamic -module
libsf_sip_preproc_la_LIBADD = ../libsf_dynamic_preproc.la
#nodist_libsf_sip_preproc_la_SOURCES = \
#../include/sf_dynamic_preproc_lib.c \
#../include/sf_ip.c \
#../include/sfPolicyUserData.c
libsf_sip_preproc_la_SOURCES = \
spp_sip.c \
spp_sip.h \
sip_config.c \
sip_config.h \
sip_parser.c \
sip_parser.h \
sip_dialog.c \
sip_dialog.h \
sip_roptions.c \
sip_roptions.h \
sip_utils.c \
sip_utils.h \
sip_debug.h \
my_new_file.c \
my_new_file.h
EXTRA_DIST = \
sf_sip.dsp
all: all-am
.SUFFIXES:
.SUFFIXES: .c .lo .o .obj
$(srcdir)/Makefile.in: # $(srcdir)/Makefile.am $(am__configure_deps)
#for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
&& { if test -f $#; then exit 0; else break; fi; }; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/dynamic-preprocessors/sip/Makefile'; \
$(am__cd) $(top_srcdir) && \
$(AUTOMAKE) --foreign src/dynamic-preprocessors/sip/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
#case '$?' in \
*config.status*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$# $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$# $(am__depfiles_maybe);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(top_srcdir)/configure: # $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): # $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(am__aclocal_m4_deps):
install-libLTLIBRARIES: $(lib_LTLIBRARIES)
#$(NORMAL_INSTALL)
test -z "$(libdir)" || $(MKDIR_P) "$(DESTDIR)$(libdir)"
#list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
list2=; for p in $$list; do \
if test -f $$p; then \
list2="$$list2 $$p"; \
else :; fi; \
done; \
test -z "$$list2" || { \
echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \
$(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \
}
uninstall-libLTLIBRARIES:
#$(NORMAL_UNINSTALL)
#list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
for p in $$list; do \
$(am__strip_dir) \
echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \
$(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \
done
clean-libLTLIBRARIES:
-test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES)
#list='$(lib_LTLIBRARIES)'; for p in $$list; do \
dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
test "$$dir" != "$$p" || dir=.; \
echo "rm -f \"$${dir}/so_locations\""; \
rm -f "$${dir}/so_locations"; \
done
libsf_sip_preproc.la: $(libsf_sip_preproc_la_OBJECTS) $(libsf_sip_preproc_la_DEPENDENCIES)
$(libsf_sip_preproc_la_LINK) -rpath $(libdir) $(libsf_sip_preproc_la_OBJECTS) $(libsf_sip_preproc_la_LIBADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT)
distclean-compile:
-rm -f *.tab.c
.c.o:
$(COMPILE) -c $<
.c.obj:
$(COMPILE) -c `$(CYGPATH_W) '$<'`
.c.lo:
$(LTCOMPILE) -c -o $# $<
sf_dynamic_preproc_lib.lo: ../include/sf_dynamic_preproc_lib.c
$(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o sf_dynamic_preproc_lib.lo `test -f '../include/sf_dynamic_preproc_lib.c' || echo '$(srcdir)/'`../include/sf_dynamic_preproc_lib.c
sf_ip.lo: ../include/sf_ip.c
$(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o sf_ip.lo `test -f '../include/sf_ip.c' || echo '$(srcdir)/'`../include/sf_ip.c
sfPolicyUserData.lo: ../include/sfPolicyUserData.c
$(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o sfPolicyUserData.lo `test -f '../include/sfPolicyUserData.c' || echo '$(srcdir)/'`../include/sfPolicyUserData.c
mostlyclean-libtool:
-rm -f *.lo
clean-libtool:
-rm -rf .libs _libs
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
mkid -fID $$unique
tags: TAGS
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
set x; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
shift; \
if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
if test $$# -gt 0; then \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
"$$#" $$unique; \
else \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$unique; \
fi; \
fi
ctags: CTAGS
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
test -z "$(CTAGS_ARGS)$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& $(am__cd) $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) "$$here"
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
distdir: $(DISTFILES)
#srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
list='$(DISTFILES)'; \
dist_files=`for file in $$list; do echo $$file; done | \
sed -e "s|^$$srcdirstrip/||;t" \
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
case $$dist_files in \
*/*) $(MKDIR_P) `echo "$$dist_files" | \
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
sort -u` ;; \
esac; \
for file in $$dist_files; do \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
if test -d $$d/$$file; then \
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
if test -d "$(distdir)/$$file"; then \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
else \
test -f "$(distdir)/$$file" \
|| cp -p $$d/$$file "$(distdir)/$$file" \
|| exit 1; \
fi; \
done
check-am: all-am
check: check-am
all-am: Makefile $(LTLIBRARIES) all-local
installdirs:
for dir in "$(DESTDIR)$(libdir)"; do \
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
done
install: install-am
install-exec: install-exec-am
install-data: install-data-am
uninstall: uninstall-am
install-am: all-am
#$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-am
install-strip:
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
`test -z '$(STRIP)' || \
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:
clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
#echo "This command is intended for maintainers to use"
#echo "it deletes files that may require special tools to rebuild."
clean: clean-am
clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \
mostlyclean-am
distclean: distclean-am
-rm -f Makefile
distclean-am: clean-am distclean-compile distclean-generic \
distclean-tags
dvi: dvi-am
dvi-am:
html: html-am
html-am:
info: info-am
info-am:
install-data-am:
install-dvi: install-dvi-am
install-dvi-am:
install-exec-am: install-libLTLIBRARIES
install-html: install-html-am
install-html-am:
install-info: install-info-am
install-info-am:
install-man:
install-pdf: install-pdf-am
install-pdf-am:
install-ps: install-ps-am
install-ps-am:
installcheck-am:
maintainer-clean: maintainer-clean-am
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
mostlyclean-am: mostlyclean-compile mostlyclean-generic \
mostlyclean-libtool
pdf: pdf-am
pdf-am:
ps: ps-am
ps-am:
uninstall-am: uninstall-libLTLIBRARIES
.MAKE: install-am install-strip
.PHONY: CTAGS GTAGS all all-am all-local check check-am clean \
clean-generic clean-libLTLIBRARIES clean-libtool ctags \
distclean distclean-compile distclean-generic \
distclean-libtool distclean-tags distdir dvi dvi-am html \
html-am info info-am install install-am install-data \
install-data-am install-dvi install-dvi-am install-exec \
install-exec-am install-html install-html-am install-info \
install-info-am install-libLTLIBRARIES install-man install-pdf \
install-pdf-am install-ps install-ps-am install-strip \
installcheck installcheck-am installdirs maintainer-clean \
maintainer-clean-generic mostlyclean mostlyclean-compile \
mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
tags uninstall uninstall-am uninstall-libLTLIBRARIES
all-local: $(LTLIBRARIES)
$(MAKE) DESTDIR=`pwd`/../build install-libLTLIBRARIES
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

Resources