]> git.e2factory.org Git - e2factory.git/commitdiff
cleanup: clean up and simplify the build system
authorGordon Hecker <gh@emlix.com>
Wed, 20 Jan 2010 17:38:29 +0000 (18:38 +0100)
committerGordon Hecker <gh@emlix.com>
Fri, 12 Feb 2010 09:51:59 +0000 (10:51 +0100)
Mainly: Nothing is built in the generic/ subdirectory any more now:
global stuff is built in global/
local stuff is built in local/
libraries are no longer renamed with _local or _global prefixes.

This is another step heading towards proper modularization - and
installing each module on its own, for both local and global
tools.

Signed-off-by: Gordon Hecker <gh@emlix.com>
generic/Makefile
generic/e2util.c
generic/loader.lua [moved from local/loader.lua with 94% similarity]
generic/luafile_ll.c
global/Makefile
global/e2-create-project.lua.in
global/e2-fetch-project.lua.in
global/e2-install-e2.lua.in
global/e2.lua.in
local/Makefile

index 0a5cad136d55c14f6715b799ca1b842615529a64..0f7f58109eec87b94e43119f25bbc17883430746 100644 (file)
@@ -32,36 +32,20 @@ TOPLEVEL = ..
 
 include $(TOPLEVEL)/make.vars
 
-CLEAN_FILES = *~ *.lc *.o *.so lua-version-map.lua e2-su-2.2
+CLEAN_FILES = *~ *.lc *.o *.so lua-version-map.lua
 
 
 .PHONY: all install uninstall local install-local clean
 
-all: e2generic_global.lc luafile_ll_global.so e2util_global.so e2-su-2.2 sha1.so
+all:
 
 install: all
-       install -m 644 e2generic_global.lc $(DESTDIR)$(LIBDIR)
-       install -m 755 sha1.so $(DESTDIR)$(LIBDIR)
-       install -m 755 luafile_ll_global.so $(DESTDIR)$(LIBDIR)
-       install -m 755 e2util_global.so $(DESTDIR)$(LIBDIR)
-       install -m 4754 -o root -g $(E2_GROUP) e2-su-2.2 $(DESTDIR)$(BINDIR)/
 
 uninstall:
-       rm -f $(DESTDIR)$(BINDIR)/e2-su-2.2
-       rm -f $(DESTDIR)$(LIBDIR)/e2generic_global.lc
-       rm -f $(DESTDIR)$(LIBDIR)/luafile_ll_global.so
-       rm -f $(DESTDIR)$(LIBDIR)/e2util_global.so
 
-local: e2generic_local.lc luafile_ll_local.so e2util_local.so sha1.so
+local:
 
 install-local: local
-       mkdir -p $(LOCALLIBDIR) $(LOCALMAKDIR)
-       install -m 755 -d $(LOCALPLUGINDIR)
-       install -m 644 e2generic_local.lc $(LOCALLIBDIR)
-       install -m 755 sha1.so $(LOCALLIBDIR)
-       install -m 755 luafile_ll_local.so $(LOCALLIBDIR)
-       install -m 755 e2util_local.so $(LOCALLIBDIR)
-       install -m 644 e2-su-2.2.c $(LOCALMAKDIR)
 
 doc:
        for s in $(SUBDIRS) ; do \
@@ -76,40 +60,8 @@ install-doc:
 clean:
        rm -f $(CLEAN_FILES)
 
-e2generic_global.lc: strict.lua collection.lua e2lib_global_prefix.lua \
-               plugin.lua \
-               e2lib.lua e2option.lua hash.lua tools.lua \
-               transport.lua cache.lua url.lua scm.git.lua \
-               luafile.lua lua-version-map.lua \
-               error.lua lock.lua
-       $(BUILD_LUAC) -o $@ $^
-
-e2generic_local.lc: strict.lua collection.lua e2lib_local_prefix.lua \
-               e2lib.lua e2option.lua hash.lua tools.lua \
-               transport.lua cache.lua url.lua scm.git.lua \
-               luafile.lua lua-version-map.lua
-       $(LUAC) -o $@ $^
-
 %: %.in
        $(TOPLEVEL)/scripts/genscript.sh $< $@
 
-e2-su-2.2: e2-su-2.2.c
-       $(CC) $(CFLAGS) $(E2_SU_CFLAGS) $(LDFLAGS) $< -o $@
-
-luafile_ll_global.so: luafile_ll.c
-       $(CC) $(CFLAGS) $(BUILD_LUA_CPPFLAGS) $(LDFLAGS) -shared -fPIC $< -o $@
-
-e2util_global.so: e2util.c
-       $(CC) $(CFLAGS) $(BUILD_LUA_CPPFLAGS) $(LDFLAGS) -shared -fPIC $< -o $@
-
-luafile_ll_local.so: luafile_ll.c
-       $(CC) -DLOCAL $(CFLAGS) $(LUA_CPPFLAGS) $(LDFLAGS) -shared -fPIC $< -o $@
-
-e2util_local.so: e2util.c
-       $(CC) -DLOCAL $(CFLAGS) $(LUA_CPPFLAGS) $(LDFLAGS) -shared -fPIC $< -o $@
-
 %.o: %.c
        $(CC) $(CFLAGS) $(LUA_CPPFLAGS) $(LDFLAGS) -fPIC -o $@ -c $<
-
-sha1.so: sha1.o lsha1.o
-       $(CC) -o $@ -shared sha1.o lsha1.o
index 7e1fed10816024c02f73a573d65981d1cb795e1b..8fbf7b20cebc1d0d9f77d954b06e8d98f66cdfb0 100644 (file)
 #include <lauxlib.h>
 
 
-#ifndef LOCAL
-# define ENTRY_POINT    luaopen_e2util_global
-#else
-# define ENTRY_POINT    luaopen_e2util_local
-#endif
-
-
 static char buffer[ PATH_MAX + 1 ];
 
 
@@ -761,7 +754,7 @@ static luaL_Reg lib[] = {
 };
 
 
-int ENTRY_POINT(lua_State *lua)
+int luaopen_e2util(lua_State *lua)
 {
   luaL_register(lua, "e2util", lib);
   globalL = lua;
similarity index 94%
rename from local/loader.lua
rename to generic/loader.lua
index 7f57fade0cbe0cc8ebc18b4c84da27594a2072bc..a95594f73a86ffc0e51d9136ba622c6620e819ee 100644 (file)
@@ -4,28 +4,28 @@
    Copyright (C) 2007-2009 Gordon Hecker <gh@emlix.com>, emlix GmbH
    Copyright (C) 2007-2009 Oskar Schirmer <os@emlix.com>, emlix GmbH
    Copyright (C) 2007-2008 Felix Winkelmann, emlix GmbH
-   
+
    For more information have a look at http://www.e2factory.org
 
    e2factory is a registered trademark by emlix GmbH.
 
    This file is part of e2factory, the emlix embedded build system.
-   
+
    e2factory 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 3 of the License, or
    (at your option) any later version.
-   
+
    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.
-   
+
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 ]]
 
 -- loads required libraries
 
-require("e2util_local")
-require("luafile_ll_local")
+require("e2util")
+require("luafile_ll")
index 72fbcb800137ca0e17fe961754347616348810b3..7b243cf9d475606e8097be58f44336129f679e8c 100644 (file)
 #include <lualib.h>
 #include <lauxlib.h>
 
-#ifndef LOCAL
-# define ENTRY_POINT luaopen_luafile_ll_global
-#else
-# define ENTRY_POINT luaopen_luafile_ll_local
-#endif
-
 static int 
 lua_fopen(lua_State *lua)
 {
@@ -263,7 +257,7 @@ static luaL_Reg lib[] = {
   { NULL, NULL }
 };
 
-int ENTRY_POINT(lua_State *lua)
+int luaopen_luafile_ll(lua_State *lua)
 {
   luaL_register(lua, "luafile_ll", lib);
   return 1;
index ee2365700ec819001acb44f3ff37d916b1a8d5c2..98fc9b7014ab7312afb14f3a6b0ecf2d2fdcb665 100644 (file)
@@ -29,6 +29,8 @@ TOPLEVEL = ..
 
 include $(TOPLEVEL)/make.vars
 
+VPATH = .:$(TOPLEVEL)/generic
+
 SCRIPTS =
 GLOBALLUATOOLS = e2-create-project e2-fetch-project e2-install-e2 e2-root
 GLOBALSHTOOLS = e2-locate-project-root e2ssh
@@ -39,7 +41,8 @@ CLEAN_FILES = *~ $(GLOBALTOOLS) *.lc e2 $(SCRIPTS) *.lua e2-su *.sh e2.conf
 .PHONY: all install uninstall clean
 
 all: e2 e2-root $(SCRIPTS) e2-su $(GLOBALLUATOOLS:=.lc) \
-       $(GLOBALSHTOOLS:=.sh) e2.conf
+       $(GLOBALSHTOOLS:=.sh) e2.conf e2generic.lc sha1.so e2-su-2.2 \
+       luafile_ll.so e2util.so
 
 install: all
        for i in $(GLOBALLUATOOLS) ; do \
@@ -58,6 +61,11 @@ install: all
        fi
        install -m 644 e2.conf $(DESTDIR)$(SYSCONFDIR)/e2.conf.sample
        install -d -m 2775 -g $(E2_GROUP) $(DESTDIR)$(LOCALSTATEDIR)
+       install -m 644 e2generic.lc $(DESTDIR)$(LIBDIR)
+       install -m 755 sha1.so $(DESTDIR)$(LIBDIR)
+       install -m 755 luafile_ll.so $(DESTDIR)$(LIBDIR)
+       install -m 755 e2util.so $(DESTDIR)$(LIBDIR)
+       install -m 4754 -o root -g $(E2_GROUP) e2-su-2.2 $(DESTDIR)$(BINDIR)/
 
 uninstall:
        for i in $(GLOBALLUATOOLS) ; do \
@@ -67,6 +75,10 @@ uninstall:
        for i in $(GLOBALSHTOOLS) ; do \
                rm -f $(DESTDIR)$(BINDIR)/$$i ; \
        done
+       rm -f $(DESTDIR)$(BINDIR)/e2-su-2.2
+       rm -f $(DESTDIR)$(LIBDIR)/e2generic.lc
+       rm -f $(DESTDIR)$(LIBDIR)/luafile_ll.so
+       rm -f $(DESTDIR)$(LIBDIR)/e2util.so
        rm -f $(DESTDIR)$(TOOLDIR)/e2-root
        rm -f $(DESTDIR)$(BINDIR)/e2-su
        rm -f $(DESTDIR)$(BINDIR)/e2
@@ -107,3 +119,28 @@ e2-root: e2-root.lc
 e2.conf: e2.conf.in
        $(TOPLEVEL)/scripts/genscript.sh $< $@
 
+e2generic.lc: strict.lua collection.lua loader.lua \
+               plugin.lua \
+               e2lib.lua e2option.lua hash.lua tools.lua \
+               transport.lua cache.lua url.lua scm.git.lua \
+               luafile.lua lua-version-map.lua \
+               error.lua lock.lua
+       $(BUILD_LUAC) -o $@ $^
+
+sha1.so: sha1.o lsha1.o
+
+luafile_ll.so: luafile_ll.o
+
+e2util.so: e2util.o
+
+%.so:
+       $(CC) -shared -o $@ $^ $(LDFLAGS)
+
+CLEAN_FILES += *.o
+%.o: %.c
+       $(CC) $(CFLAGS) $(BUILD_LUA_CPPFLAGS) -fPIC -c -o $@ $<
+
+CLEAN_FILES += e2-su-2.2
+e2-su-2.2: e2-su-2.2.c
+       $(CC) $(CFLAGS) $(E2_SU_CFLAGS) $(LDFLAGS) $< -o $@
+
index 413ca27e53a2462d0c621ac02bdabb47d8b57d28..eb33720d57e0b7ea8923bd19febd67a96707d371 100755 (executable)
@@ -26,7 +26,7 @@
 ]]
 
 require("buildconfig")
-require("e2generic_global")
+require("e2generic")
 
 e2lib.init()
 
index 760efda9f6e68290a298258380897ff0c072dbf0..585a369c60cc3d8f3127cb5d9ae425bb2eea500c 100755 (executable)
@@ -26,7 +26,7 @@
 ]]
 
 require("buildconfig")
-require("e2generic_global")
+require("e2generic")
 
 e2lib.init()
 local e = new_error("fetching project failed")
index b862740081ffda639f178683b1293475c0c7d148..683c9c97b2edc2c584cc3a425fb0c3c0c1c4233b 100755 (executable)
@@ -26,7 +26,7 @@
 ]]
 
 require("buildconfig")
-require("e2generic_global")
+require("e2generic")
 
 install_prefix = buildconfig.PREFIX
 
index 609c6e0e6b53339d7c60525332e4e60d3a2000e9..9fb6e0ac0dfab6a64366d25c5fc76375a5f8c4e4 100755 (executable)
@@ -29,7 +29,7 @@ package.path  = "@LIBDIR@/?.lc;@LIBDIR@/?.lua"
 package.cpath = "@LIBDIR@/?.so"
 
 require("buildconfig")
-require("e2generic_global")
+require("e2generic")
 e2lib.init()
 
 e2option.documentation = [[
index d944cd99df3c72c03d53f7ffc076dbb35cce04ce..caf89de2a2fee9e99ca705c28c3dbd8768a980c8 100644 (file)
@@ -32,6 +32,8 @@ TOPLEVEL = ..
 
 include $(TOPLEVEL)/make.vars
 
+VPATH = .:$(TOPLEVEL)/generic
+
 CLEAN_FILES = *~ *.so linux32 *.lc *.o
 CFLAGS += -I. -I$(DESTDIR)$(INCDIR) -I$(DESTDIR)$(INCDIR)/lua-$(LUA_VERSION) \
        -I../lua/lua-$(LUA_VERSION)/src -fPIC
@@ -48,7 +50,7 @@ SYMLINKS_2_1 = lookup-server use-source prepare-cargo sync-results cleanup \
 .PHONY: all install uninstall install install-local doc install-doc
 
 
-all: linux32 e2local.lc $(LOCALLUATOOLS:=.lc)
+all: linux32 e2local.lc $(LOCALLUATOOLS:=.lc) sha1.so luafile_ll.so e2util.so
 
 install:
        # install symlinks for e2-2.1 compatibility
@@ -59,9 +61,10 @@ install:
                ln -sf e2 $(DESTDIR)$(BINDIR)/e2-$$i ; \
        done
 
-install-local: all
+install-local: all install_sourcefiles
        test -n "$(PROJECTDIR)"
        mkdir -p $(LOCALBINDIR) $(LOCALMAKDIR) $(LOCALLIBDIR)
+       install -m 755 -d $(LOCALPLUGINDIR)
        install -m644 e2local.lc $(LOCALLIBDIR)/
        for i in $(LOCALLUATOOLS); do \
                install -m 755 $$i.lc $(LOCALBINDIR)/e2-$$i; \
@@ -73,6 +76,13 @@ install-local: all
        install -m644 linux32.c $(LOCALMAKDIR)/
        ln -sf $(LIBEXECDIR)/e2-lua-$(LUA_VERSION) $(LOCALBINDIR)/e2-lua
        $(MAKE) -C make install-local
+       install -m 755 sha1.so $(LOCALLIBDIR)
+       install -m 755 luafile_ll.so $(LOCALLIBDIR)
+       install -m 755 e2util.so $(LOCALLIBDIR)
+
+.PHONY: install_sourcefiles
+install_sourcefiles: e2-su-2.2.c
+       install -m 644 $^ $(LOCALMAKDIR)
 
 doc:
        for s in $(SUBDIRS) ; do \
@@ -123,3 +133,12 @@ e2local.lc: $(TOPLEVEL)/generic/strict.lua \
        $(LUAC) -o $@ $^
 
 linux32: linux32.c
+
+sha1.so: sha1.o lsha1.o
+
+luafile_ll.so: luafile_ll.o
+
+e2util.so: e2util.o
+
+%.so:
+       $(CC) -shared -o $@ $^ $(LDFLAGS)