mirror of
git://projects.qi-hardware.com/wernermisc.git
synced 2024-12-31 00:16:46 +02:00
bbf9c42bc8
- Makefile (OBJS_qpkg): added pkg.o - gobble.c (gobble_buf): moved "struct pkg" allocation to function new_pkg in pkg.c - qpkg.h: moved "struct pkg" and subordinate structures to pkg.h - pkg.h, pkg.c (new_pkg, free_pkg): provide package structure definition, allocation, and deallocation - fixup.c, gobble.c, prereq.c, qpkg.c: include "pkg.h" - gobble.c (finish_pkg): use free_pkg instead of just "free" to avoid leaking memory
99 lines
2.5 KiB
Makefile
99 lines
2.5 KiB
Makefile
#
|
|
# Makefile - Makefile of qpkg
|
|
#
|
|
# Written 2010 by Werner Almesberger
|
|
# Copyright 2010 by Werner Almesberger
|
|
#
|
|
# This program is free software; you can redistribute it and/or modify
|
|
# it under the terms of the GNU General Public License as published by
|
|
# the Free Software Foundation; either version 2 of the License, or
|
|
# (at your option) any later version.
|
|
#
|
|
|
|
SHELL = /bin/bash
|
|
|
|
OBJS_qpkg = fixup.o gobble.o id.o pkg.o prereq.o qpkg.o jrb.o
|
|
OBJS_rbtest = rbtest.o jrb.o
|
|
OBJS = $(OBJS_qpkg) $(OBJS_rbtest)
|
|
|
|
CFLAGS = -Wall -Wshadow -Wmissing-prototypes -g -O
|
|
# -O, so that we get data flow analysis, which helps to find more bugs
|
|
#LDFLAGS=-pg
|
|
|
|
# ----- Verbosity control -----------------------------------------------------
|
|
|
|
CC_normal := $(CC)
|
|
DEPEND_normal := $(CPP) $(CFLAGS) -MM -MG
|
|
|
|
CC_quiet = @echo " CC " $@ && $(CC_normal)
|
|
DEPEND_quiet = @$(DEPEND_normal)
|
|
|
|
ifeq ($(V),1)
|
|
CC = $(CC_normal)
|
|
DEPEND = $(DEPEND_normal)
|
|
else
|
|
CC = $(CC_quiet)
|
|
DEPEND = $(DEPEND_quiet)
|
|
endif
|
|
|
|
# ----- Rules -----------------------------------------------------------------
|
|
|
|
.PHONY: all jlime openwrt test tests valgrind clean spotless
|
|
|
|
all: qpkg rbtest
|
|
|
|
jlime:
|
|
$(MAKE) clean
|
|
$(MAKE) CC_normal=mipsel-linux-gcc
|
|
|
|
#
|
|
# OpenWRT uses mipsel-openwrt-linux-* and mipsel-openwrt-linux-uclibc-*.
|
|
# They should both be available, but just in case, let's improve our odds
|
|
# of picking a compiler that actualy exists.
|
|
#
|
|
|
|
openwrt:
|
|
$(MAKE) clean
|
|
$(MAKE) CC_normal=$(shell \
|
|
n=`which mipsel-openwrt-linux-gcc`; \
|
|
echo "$${n:-`which mipsel-openwrt-linux-uclibc-gcc`}")
|
|
|
|
qpkg: $(OBJS_qpkg)
|
|
|
|
rbtest: $(OBJS_rbtest)
|
|
|
|
# ----- Tests -----------------------------------------------------------------
|
|
|
|
test tests: all
|
|
LANG= sh -c \
|
|
'passed=0 && cd test && \
|
|
for n in [a-z]*; do \
|
|
[ $$n != core ] && SCRIPT=$$n CWD_PREFIX=.. . ./$$n; done; \
|
|
echo "Passed all $$passed tests"'
|
|
|
|
valgrind:
|
|
VALGRIND="valgrind -q" $(MAKE) tests
|
|
|
|
# ----- Cleanup ---------------------------------------------------------------
|
|
|
|
clean:
|
|
rm -f $(OBJS) $(OBJS:.o=.d)
|
|
|
|
spotless: clean
|
|
rm -f qpkg rbtest
|
|
|
|
# ----- Dependencies ----------------------------------------------------------
|
|
|
|
# compile and generate dependencies, from fped, based on
|
|
# http://scottmcpeak.com/autodepend/autodepend.html
|
|
|
|
%.o: %.c
|
|
$(CC) -c $(CFLAGS) $*.c -o $*.o
|
|
$(DEPEND) $*.c | \
|
|
sed -e \
|
|
'/^\(.*:\)\? */{p;s///;s/ *\\\?$$/ /;s/ */:\n/g;H;}' \
|
|
-e '$${g;p;}' -e d >$*.d; \
|
|
[ "$${PIPESTATUS[*]}" = "0 0" ] || { rm -f $*.d; exit 1; }
|
|
|
|
-include $(OBJS:.o=.d)
|