From af1b460033d874f1b1fd5ac248d49b0a6bb7363a Mon Sep 17 00:00:00 2001 From: Timo Teras Date: Thu, 16 Apr 2009 13:49:16 +0300 Subject: build: rewrite make system to something slightly similar to kbuild Tracks now probler header file dependencies and command line parameters used to build files. E.g. changing CFLAGS rebuild all C-files. And changing version rebuild now the files where it's used. --- src/Makefile | 57 ++++++++++++--------------------------------------------- 1 file changed, 12 insertions(+), 45 deletions(-) (limited to 'src/Makefile') diff --git a/src/Makefile b/src/Makefile index d4a7244..993ca91 100644 --- a/src/Makefile +++ b/src/Makefile @@ -1,50 +1,17 @@ -# Makefile - one file to rule them all, one file to bind them -# -# Copyright (C) 2007 Timo Teräs -# All rights reserved. -# -# This program is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License version 3 as published -# by the Free Software Foundation. See http://www.gnu.org/ for details. +progs-y += apk +apk-objs := state.o database.o package.o archive.o \ + version.o io.o url.o gunzip.o blob.o \ + hash.o md5.o apk.o \ + add.o del.o ver.o index.o info.o search.o \ + fetch.o audit.o +CFLAGS_apk.o := -DAPK_VERSION=\"$(FULL_VERSION)\" -TARGETS = apk +progs-$(STATIC) += apk.static +apk.static-objs := $(apk-objs) +LDFLAGS_apk.static := -static -apk_OBJS = \ - state.o \ - database.o \ - package.o \ - archive.o \ - version.o \ - io.o \ - url.o \ - gunzip.o \ - blob.o \ - hash.o \ - md5.o \ - add.o \ - del.o \ - ver.o \ - index.o \ - info.o \ - search.o \ - fetch.o \ - audit.o \ - apk.o - -ALL_OBJS = $(apk_OBJS) - -all: $(TARGETS) - -apk: $(apk_OBJS) - $(CC) $(LDFLAGS) -o $@ $^ $(LIBS) - -apk.static: $(apk_OBJS) - $(CC) $(LDFLAGS) -static -o $@ $^ $(LIBS) - -clean:: - @rm -f $(TARGETS) $(ALL_OBJS) +LIBS := /usr/lib/libz.a install:: $(INSTALLDIR) $(DESTDIR)$(SBINDIR) - $(INSTALL) $(TARGETS) $(DESTDIR)$(SBINDIR) - + $(INSTALL) $(obj)/apk $(DESTDIR)$(SBINDIR) -- cgit v1.2.3-70-g09d2