- Ubuntu Linux作为开发环境,使用gcc交叉编译为ARM处理器。编译器:arm-angstrom-linux-gnueabi-gcc。
- 下载poco 1.4.2p1,并解压,进入解压后的目录。
- 创建配置文件:
- 有两个配置文件可以使用:build/config/Angstrom和build/config/ARM-Linux。Angstrom没有指定openssl库的头文件和库文件的位置,所以除非它们在编译器已知的位置,否则会编译不通过。ARM-Linux使用STLport作为C++的标准库,而不是gcc自带的C++标准库,而且在配置文件中有指定openssl的位置信息。
- 由于我们已经有gcc自带的C++标准库,所以不需要STDport。而且我们希望指定Openssl的位置。所以我们需要创建一个自己的配置文件,可以基于这两个文件的任何一个。这里以ARM-Linux为基础。
- 在build/config目录中,复制ARM-Linux为AT91-Linux。修改AT91-Linux文件:
- 修改OPENSSL_INCLUDE和OPENSSL_LIB,使他们指向正确的目录。
- 修改TOOL为:arm-angstrom-linux-gnueabi。
- 修改SYSFLAGS:去掉‘-I$(STLPORT_INCLUDE)'。
- 修改SYSLIBS:去掉'-L$(STLPORT_LIB)'。
- 配置代码:回到poco顶级目录,运行:./configure --config=AT91-Linux --omit=Data/ODBC,Data/MySQL,PageCompiler,PageCompiler/File2Page
- 编译代码:make
- 编译的结果在:lib/Linux/ARM中。
- stripped库大小为:4.9MB,包括:CppUnit, Crypto, Data, DataSQLite, Foundation, Net, NetSSL, Util, XML, Zip.
2012-03-06
交叉编译Poco 1.4.2p1
Embedded Linux Memory Consumption
ARM Linux 2.6.27.19 on Atmel
After starts up, 'top' shows 17892K memory used.
After starts dropbear, another 192K used.
After starts lighttpd and two php-cgi processes, it takes another 1444K.
The major C++ application (two processes) takes about 6204K.
After starts up, 'top' shows 17892K memory used.
After starts dropbear, another 192K used.
After starts lighttpd and two php-cgi processes, it takes another 1444K.
The major C++ application (two processes) takes about 6204K.
2012-02-27
C++ Structure and Class size
C++中,同样数据成员的struct和class的大小(sizeof)是相同的。带有成员函数的class并不增加大小,但是带有virtual函数的class会增加4 bytes。
===== Test Pprogram ===
#include <iostream>
using namespace std;
struct S {
int a;
int b;
};
class C {
public:
int a;
int b;
};
class CF {
public:
int a;
int b;
void f1() {};
void f2() {};
void f3() {};
};
class CVF {
public:
int a;
int b;
virtual void f1() {};
virtual void f2() {};
virtual void f3() {};
};
int main(int argc, char** argv)
{
cout << "Size of struct S " << sizeof(struct S) << endl;
cout << "Size of class C " << sizeof(C) << endl;
cout << "Size of class CF " << sizeof(CF) << endl;
cout << "Size of class CVF " << sizeof(CVF) << endl;
return 0;
}
===== Test Pprogram ===
#include <iostream>
using namespace std;
struct S {
int a;
int b;
};
class C {
public:
int a;
int b;
};
class CF {
public:
int a;
int b;
void f1() {};
void f2() {};
void f3() {};
};
class CVF {
public:
int a;
int b;
virtual void f1() {};
virtual void f2() {};
virtual void f3() {};
};
int main(int argc, char** argv)
{
cout << "Size of struct S " << sizeof(struct S) << endl;
cout << "Size of class C " << sizeof(C) << endl;
cout << "Size of class CF " << sizeof(CF) << endl;
cout << "Size of class CVF " << sizeof(CVF) << endl;
return 0;
}
==== Result ====
Size of struct S 8
Size of class C 8
Size of class CF 8
Size of class CVF 12
2012-01-13
Python / Twisted / WebSocket / Protobuf on Windows 7 (64bit)
Python Basic
============
- Install 32-bit Python 2.7.2
- Install setuptool-0.6c11.win32-py2.7.exe (easy_install)
Twisted Framework and SSL support
=================================
- Install Twisted-11.1.0 from source code ( it installs zope interface automatically from internet)
unzip Twisted-11.1.0.tar.bz2
cd Twisted-11.1.0
setup.py install
- Install Win32OpenSSL 32bit 1.0.0e
- Install pyOpenSSL (Twisted SSL support needs this)
cd c:\python2.7\scripts
easy_install pyopenssl
WebSocket Autobahn
==================
- Install Autobahn from source code
unzip autobahn
cd autobahn\lib\python
setup.py install
Test the Autobahn installation
cd autobahn\demo\echo
echo_server.py
In another DOS window
cd autobahn\demo\echo
echo_client.py
Test the SSL support of WebSocket and Twisted
cd autobahn\demo\echo_tls
echo_tls_server.py
In another DOS window
cd autobahn\demo\echo_tls
echo_tls_client.py -u wss://localhost:9000
Protobuf and Protobuf.socketrpc
===============================
- Install protobuf Python library from source code
unzip protobuf-2.4.1-win32.zip
cd protobuf-2.4.1\python
setup.py install
- Install protobuf compiler Windows binary
create d:\temp\protoc
add d:\temp\protoc to PATH
put protoc.exe into d:\temp\protoc
- Install protobuf.socketrpc from source code
unzip protobuf.socketrpc-1.3.2.tar.gz
cd protobuf.socketrpc-1.3.2
setup.py install
Test the protobuf.socketrpc
cd protobuf.socketrpc-1.3.2\src\protobuf\socketrpc\examples\helloworld
run_server.py
In another DOS windows
cd protobuf.socketrpc-1.3.2\src\protobuf\socketrpc\examples\helloworld
run_client.py
IIS 7.5 HTTPS Configuration and Certificate Installation
How to Generate a Server Certificate for the IIS server 7.5?
============================================================
Background
----------
There're different ways to generate server certificate for IIS server 7.5. Here's
a way to use a private CA to sign the server certificate.
The private CA here is a openssl based CA. To set up the CA, you have to run a Linux
with openssl installed. There're couple of shell scripts to help create the CA and
sign certificate request.
For this testing, the private CA is running on Aric's Ubuntu Linux. The certificate
of the CA is included below.
-----BEGIN CERTIFICATE-----
MIIDcjCCAtugAwIBAgIJAI1vSteGwmBkMA0GCSqGSIb3DQEBBQUAMIGDMQswCQYD
VQQGEwJBVTEMMAoGA1UECBMDTlNXMQ8wDQYDVQQHEwZTeWRuZXkxEDAOBgNVBAoT
B1NpZW1lbnMxCzAJBgNVBAsTAlNQMRAwDgYDVQQDEwdPcGVuU1NMMSQwIgYJKoZI
hvcNAQkBFhVhcmljLndhbmdAc2llbWVucy5jb20wHhcNMTExMjAyMDMwNzMzWhcN
MTQxMjAxMDMwNzMzWjCBgzELMAkGA1UEBhMCQVUxDDAKBgNVBAgTA05TVzEPMA0G
A1UEBxMGU3lkbmV5MRAwDgYDVQQKEwdTaWVtZW5zMQswCQYDVQQLEwJTUDEQMA4G
A1UEAxMHT3BlblNTTDEkMCIGCSqGSIb3DQEJARYVYXJpYy53YW5nQHNpZW1lbnMu
Y29tMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCnacafZQPmnyVhtP+LLaxY
WM3sSJJ0msivxcyPCfD9nLNK3P34aQyeNlUgqZc5mAp0Je/zURXAsi+t2WjUA8pF
wFsxxKC10TE/qobhXsT+RwfkkvDUh5poCN9jdWgzg1Zs3uKNbCuj/AgT/dWr+cry
yYZTryMuX4jIyAA4ca3ggQIDAQABo4HrMIHoMB0GA1UdDgQWBBQjct00RwGzBIR1
WXEPTdH1DHHRETCBuAYDVR0jBIGwMIGtgBQjct00RwGzBIR1WXEPTdH1DHHREaGB
iaSBhjCBgzELMAkGA1UEBhMCQVUxDDAKBgNVBAgTA05TVzEPMA0GA1UEBxMGU3lk
bmV5MRAwDgYDVQQKEwdTaWVtZW5zMQswCQYDVQQLEwJTUDEQMA4GA1UEAxMHT3Bl
blNTTDEkMCIGCSqGSIb3DQEJARYVYXJpYy53YW5nQHNpZW1lbnMuY29tggkAjW9K
14bCYGQwDAYDVR0TBAUwAwEB/zANBgkqhkiG9w0BAQUFAAOBgQCS8DsJnkgFHPBt
Q+dhFLDvnu3ZwgU0iSaZVmEzyclDAbgnrde3rzofHoFX/c/4MZJf2NYg992REiOO
TNp9wuN/yxlRcCxZQYRzLoqkBoYGQwFj705Um83DX7jOGVwdFF2o7GVN0QnvXHBY
2JsGjKthN6VDWi2jZjzaLPBot9hilA==
-----END CERTIFICATE-----
The CA certificate might be needed on the client side in order to verify the certificates
signed by this CA. If needed, just copy above CA contents (including begin and end lines)
to a text file, and import it into the client system. It might be different about how to
import the CA certificate on different systems.
Steps to Create Server Certificate for IIS 7.5
----------------------------------------------
1. Create certificate request on IIS 7.5
a. Open IIS Manager;
b. Select the server you are going to create certificate;
c. In the 'Features View', double click 'Server Certificates'. It shows a list of the
certificates installed for this server;
d. In the 'Actions' panel, click 'Create Certificate Request...';
e. In the new dialog box, enter the information required. Could use the server name as the
'Common Name'. Click 'Next';
f. Choose 'Microsoft RSA SChannel Cryptographic Provider' and '1024' bit length. Click
'Next';
g. Click the browse button to select a folder and file name to save the certificate request.
Click 'Finish'.
2. Send the certificate request to the CA to sign it
Just copy the file you saved above and send to Aric.
3. The CA signs the certificate
Aric will sign this certificate request and send back the certificate.
4. Install the certificate on IIS 7.5
a. Save the signed certificate into a folder on the server;
b. Open IIS Manager, select the server you are going to create certificate;
c. In the 'Features View', double click 'Server Certificates'. It shows a list of the
certificates installed for this server;
d. In the 'Actions' panel, click 'Complete Certificate Request...';
e. In the new dialog box, click the browse button to find the certificate file just saved;
Note you may need to set the filter to '*.*' rather than '*.cer' if the certificate is
saved with a different suffix from '.cer'.
f. In 'Friendly name' field, enter something, i.e. Aric signed certificate. Click 'OK'.
g. If everything is ok, now you have installed the certificate on IIS 7.5;
5. Enable HTTPS for the web site
a. Open IIS Manager;
b. Select the server you are going to create certificate;
c. Navigate to the web site you want to enable HTTPS;
d. In 'Features View', under 'Actions' panel, click 'Bindings...';
e. If there's no https binding enabled, you click 'Add...' to add it. If it already exists,
click 'Edit...' to modify it;
f. In the new dialog box, choose the 'https' Type, enter your port number in 'Port'. Under
'SSL certificate:', select the certificate you just installed in step 4. Click 'OK' to
finish. There might come up with some warnings, just click OK to finish it.
g. Now back to 'Site Bindings' dialog, click 'Close';
h. Restart the web site by clicking 'Restart' under the 'Actions' panel.
6. Now your web site should work with HTTPS. You can open a browser to test it.
Labels:
certificate,
configuration,
HTTPS,
IIS,
windows
Makefile example 2
#
# Introduction
#
# This is a Makefile example which can be used to build library or program from
# given directories. These directories could be at the same folder of the Makefile
# itself, or they could exist in other levels of the Makefile, sub-folders or
# parent-folders.
#
# The Makefile searches all the .cpp files in the given folders and compile them
# into object files and link them into library or program. It generates dependency
# files automatically so that it can catch any change or the source files or
# related header files.
#
# All the output of the make process is put in $(ODIR) folder. The default value
# is 'Build', but can be overriden with 'ODIR=xxx' when executing 'make'.
#
# This makefile example contains a example to search folders and sub-folders for
# source file, and then collect all the folders.
#
PWD := $(abspath $(shell pwd))
TOP_DIR := $(abspath ../../..)
ODIR ?= Build
#
# The final targat. Should define only one of them: PROG or LIB
#
PROG :=
LIB := libapclient.a
#
# Find all the directories containing any generated CPP file.
#
GENERATED_TOP_DIR := $(TOP_DIR)/Dingo/Client/AccessPoint/GeneratedServices
GENERATED_CPP_FILES := $(shell find $(GENERATED_TOP_DIR) -name *.cpp)
GENERATED_CPP_DIRS := $(sort $(dir $(GENERATED_CPP_FILES)))
#
# The modules (directories) that need to be built. All the .cpp files in these
# directories will be built automatically.
#
MODULES := \
$(TOP_DIR)/Dingo/Client/AccessPoint/TinyXML \
$(TOP_DIR)/Dingo/Gateway/Siemens.Gateway.Linux.Client \
$(TOP_DIR)/Dingo/Gateway/PlatformSpecific/Linux \
$(GENERATED_CPP_DIRS)
# CFLAGS for compiling
CFLAGS := -MD -MP -g \
-I. \
-I$(TOP_DIR)/Dingo/Client/AccessPoint/GatewayClient \
-I$(TOP_DIR)/Dingo/Client/AccessPoint/GatewayProxy \
-I$(TOP_DIR)/Dingo/Client/AccessPoint/GatewayProxy/gSoap \
-I$(TOP_DIR)/Dingo/Client/AccessPoint/TinyXML \
-I$(TOP_DIR)/Dingo/Gateway \
-I$(TOP_DIR)/Dingo/Gateway/PlatformSpecific/Linux \
-I$(TOP_DIR)/Dingo/Client/AccessPoint/GeneratedServices \
#
# -DDEBUG to enable logging of gSoap library
#
ifeq ($(DEBUG),yes)
CFLAGS += -DDEBUG
endif
ifeq ($(OPENSSL),yes)
CFLAGS += -DWITH_OPENSSL
endif
ifeq ($(ARM),yes)
CFLAGS += -I$(TOP_DIR)/../application/include
endif
#
# LDFLAGS for linking PROG
#
LDFLAGS :=
#
# Common Part
#
ifneq ($(ARM),yes)
CROSS_COMPILE =
endif
SRC_DIRS := $(MODULES)
INC_DIRS := $(MODULES)
BUILD_DIRS:= $(addprefix $(ODIR),$(subst $(TOP_DIR),,$(MODULES)))
SRCS := $(foreach sdir,$(SRC_DIRS),$(wildcard $(sdir)/*.cpp))
OBJS := $(patsubst %.cpp,%.o,$(addprefix $(ODIR),$(subst $(TOP_DIR),,$(SRCS))))
DEPS := $(OBJS:.o=.d)
INCLUDES := $(addprefix -I,$(INC_DIRS))
CFLAGS += $(INCLUDES)
CC := $(CROSS_COMPILE)g++
LD := $(CROSS_COMPILE)g++
AR := $(CROSS_COMPILE)ar
ECHO := echo
MKDIR := mkdir -p
RM := rm -rf
LN := ln -sf
vpath %.cpp $(SRC_DIRS)
define make-goal
$1/%.o : %.cpp
@$(ECHO) "CC $$<"
@$(CC) $(CFLAGS) -c $$< -o $$@
endef
.PHONY: all checkdirs clean
all: checkdirs $(ODIR)/$(LIB) $(ODIR)/$(PROG)
ifneq ($(PROG),)
$(ODIR)/$(PROG): $(OBJS)
@$(ECHO) "LD $@"
@$(LD) -o $@ $(OBJS) $(LIBS) $(LDFLAGS)
endif
ifneq ($(LIB),)
$(ODIR)/$(LIB): $(OBJS)
@$(ECHO) "AR $@"
@$(AR) crs $@ $(OBJS)
endif
checkdirs: $(BUILD_DIRS)
$(BUILD_DIRS):
@$(ECHO) "MKDIR $@"
@$(MKDIR) -p $@
clean:
@$(RM) $(BUILD_DIRS) $(ODIR) $(TOP_DIR)/Dingo/Client/AccessPoint/TinyXML
$(foreach bdir,$(BUILD_DIRS),$(eval $(call make-goal,$(bdir))))
-include $(DEPS)
test:
@echo $(GENERATED_CPP_DIRS)
# Introduction
#
# This is a Makefile example which can be used to build library or program from
# given directories. These directories could be at the same folder of the Makefile
# itself, or they could exist in other levels of the Makefile, sub-folders or
# parent-folders.
#
# The Makefile searches all the .cpp files in the given folders and compile them
# into object files and link them into library or program. It generates dependency
# files automatically so that it can catch any change or the source files or
# related header files.
#
# All the output of the make process is put in $(ODIR) folder. The default value
# is 'Build', but can be overriden with 'ODIR=xxx' when executing 'make'.
#
# This makefile example contains a example to search folders and sub-folders for
# source file, and then collect all the folders.
#
PWD := $(abspath $(shell pwd))
TOP_DIR := $(abspath ../../..)
ODIR ?= Build
#
# The final targat. Should define only one of them: PROG or LIB
#
PROG :=
LIB := libapclient.a
#
# Find all the directories containing any generated CPP file.
#
GENERATED_TOP_DIR := $(TOP_DIR)/Dingo/Client/AccessPoint/GeneratedServices
GENERATED_CPP_FILES := $(shell find $(GENERATED_TOP_DIR) -name *.cpp)
GENERATED_CPP_DIRS := $(sort $(dir $(GENERATED_CPP_FILES)))
#
# The modules (directories) that need to be built. All the .cpp files in these
# directories will be built automatically.
#
MODULES := \
$(TOP_DIR)/Dingo/Client/AccessPoint/TinyXML \
$(TOP_DIR)/Dingo/Gateway/Siemens.Gateway.Linux.Client \
$(TOP_DIR)/Dingo/Gateway/PlatformSpecific/Linux \
$(GENERATED_CPP_DIRS)
# CFLAGS for compiling
CFLAGS := -MD -MP -g \
-I. \
-I$(TOP_DIR)/Dingo/Client/AccessPoint/GatewayClient \
-I$(TOP_DIR)/Dingo/Client/AccessPoint/GatewayProxy \
-I$(TOP_DIR)/Dingo/Client/AccessPoint/GatewayProxy/gSoap \
-I$(TOP_DIR)/Dingo/Client/AccessPoint/TinyXML \
-I$(TOP_DIR)/Dingo/Gateway \
-I$(TOP_DIR)/Dingo/Gateway/PlatformSpecific/Linux \
-I$(TOP_DIR)/Dingo/Client/AccessPoint/GeneratedServices \
#
# -DDEBUG to enable logging of gSoap library
#
ifeq ($(DEBUG),yes)
CFLAGS += -DDEBUG
endif
ifeq ($(OPENSSL),yes)
CFLAGS += -DWITH_OPENSSL
endif
ifeq ($(ARM),yes)
CFLAGS += -I$(TOP_DIR)/../application/include
endif
#
# LDFLAGS for linking PROG
#
LDFLAGS :=
#
# Common Part
#
ifneq ($(ARM),yes)
CROSS_COMPILE =
endif
SRC_DIRS := $(MODULES)
INC_DIRS := $(MODULES)
BUILD_DIRS:= $(addprefix $(ODIR),$(subst $(TOP_DIR),,$(MODULES)))
SRCS := $(foreach sdir,$(SRC_DIRS),$(wildcard $(sdir)/*.cpp))
OBJS := $(patsubst %.cpp,%.o,$(addprefix $(ODIR),$(subst $(TOP_DIR),,$(SRCS))))
DEPS := $(OBJS:.o=.d)
INCLUDES := $(addprefix -I,$(INC_DIRS))
CFLAGS += $(INCLUDES)
CC := $(CROSS_COMPILE)g++
LD := $(CROSS_COMPILE)g++
AR := $(CROSS_COMPILE)ar
ECHO := echo
MKDIR := mkdir -p
RM := rm -rf
LN := ln -sf
vpath %.cpp $(SRC_DIRS)
define make-goal
$1/%.o : %.cpp
@$(ECHO) "CC $$<"
@$(CC) $(CFLAGS) -c $$< -o $$@
endef
.PHONY: all checkdirs clean
all: checkdirs $(ODIR)/$(LIB) $(ODIR)/$(PROG)
ifneq ($(PROG),)
$(ODIR)/$(PROG): $(OBJS)
@$(ECHO) "LD $@"
@$(LD) -o $@ $(OBJS) $(LIBS) $(LDFLAGS)
endif
ifneq ($(LIB),)
$(ODIR)/$(LIB): $(OBJS)
@$(ECHO) "AR $@"
@$(AR) crs $@ $(OBJS)
endif
checkdirs: $(BUILD_DIRS)
$(BUILD_DIRS):
@$(ECHO) "MKDIR $@"
@$(MKDIR) -p $@
clean:
@$(RM) $(BUILD_DIRS) $(ODIR) $(TOP_DIR)/Dingo/Client/AccessPoint/TinyXML
$(foreach bdir,$(BUILD_DIRS),$(eval $(call make-goal,$(bdir))))
-include $(DEPS)
test:
@echo $(GENERATED_CPP_DIRS)
Makefile example 1
#
# Introduction
#
# This is a Makefile example which can be used to build library or program from
# given directories. These directories could be at the same folder of the Makefile
# itself, or they could exist in other levels of the Makefile, sub-folders or
# parent-folders.
#
# The Makefile searches all the .cpp files in the given folders and compile them
# into object files and link them into library or program. It generates dependency
# files automatically so that it can catch any change or the source files or
# related header files.
#
# All the output of the make process is put in $(ODIR) folder. The default value
# is 'Build', but can be overriden with 'ODIR=xxx' when executing 'make'.
#
#
# The folder where the Makefile exists
PWD := $(abspath $(shell pwd))
# A common folder which is parent-folder of all given folders in $(MODULES)
TOP_DIR := $(abspath ../../..)
# The default output folder, could be overriden with 'ODIR=xxx' when 'make'.
ODIR ?= Build
# The final targat. Should define only one of them: PROG or LIB
PROG :=
LIB := libapclient.a
# The modules (directories) that need to be built. All the .cpp files in these
# directories will be built automatically. They should be specified with prefix
# of$(TOP_DIR).
MODULES := \
$(TOP_DIR)/Dingo/Client/AccessPoint/ServiceProxy \
$(TOP_DIR)/Dingo/Client/AccessPoint/ServiceProxy/gSoap \
$(TOP_DIR)/Dingo/Client/AccessPoint/Services/IncomingEventService/Source/DataObjects \
$(TOP_DIR)/Dingo/Client/AccessPoint/Services/IncomingEventService/Source/MetadataObjects \
$(TOP_DIR)/Dingo/Client/AccessPoint/Services/IncomingEventService/Source/Services \
$(TOP_DIR)/Dingo/Gateway/Siemens.Gateway.Linux.Client \
$(TOP_DIR)/Dingo/Client/AccessPoint/TinyXML
# The external libs need to be linked. This is used when build program.
LIBS :=
# CFLAGS for compiling. -MD -MP must be kept.
CFLAGS := -MD -MP -g -I. \
-I$(TOP_DIR)/Dingo/Gateway \
-I$(TOP_DIR)/Dingo/Gateway/PlatformSpecific/CPP \
-I$(TOP_DIR)/Dingo/Client/AccessPoint/Services/IncomingEventService \
-I$(TOP_DIR)/Dingo/Client/AccessPoint/TinyXML
# LDFLAGS for linking. It's only used when build program.
LDFLAGS :=
# Cross compile option
ifneq ($(ARM),yes)
CROSS_COMPILE =
endif
################################################################################
# Below part should be considered as standard and normally don't need to change!
################################################################################
SRC_DIRS := $(MODULES)
BUILD_DIRS:= $(addprefix $(ODIR),$(subst $(TOP_DIR),,$(MODULES)))
SRCS := $(foreach sdir,$(SRC_DIRS),$(wildcard $(sdir)/*.cpp))
OBJS := $(patsubst %.cpp,%.o,$(addprefix $(ODIR),$(subst $(TOP_DIR),,$(SRCS))))
DEPS := $(OBJS:.o=.d)
INCLUDES := $(addprefix -I,$(SRC_DIRS))
CFLAGS += $(INCLUDES)
CC := $(CROSS_COMPILE)g++
LD := $(CROSS_COMPILE)g++
AR := $(CROSS_COMPILE)ar
ECHO := echo
MKDIR := mkdir -p
RM := rm -rf
LN := ln -sf
vpath %.cpp $(SRC_DIRS)
define make-goal
$1/%.o : %.cpp
@$(ECHO) "CC $$<"
@$(CC) $(CFLAGS) -c $$< -o $$@
endef
.PHONY: all checkdirs clean
all: checkdirs $(ODIR)/$(LIB) $(ODIR)/$(PROG)
ifneq ($(PROG),)
$(ODIR)/$(PROG): $(OBJS)
@$(ECHO) "LD $@"
@$(LD) -o $@ $(OBJS) $(LIBS) $(LDFLAGS)
endif
ifneq ($(LIB),)
$(ODIR)/$(LIB): $(OBJS)
@$(ECHO) "AR $@"
@$(AR) crs $@ $(OBJS)
endif
checkdirs: $(BUILD_DIRS)
$(BUILD_DIRS):
@$(ECHO) "MKDIR $@"
@$(MKDIR) -p $@
clean:
@$(RM) $(BUILD_DIRS) $(ODIR)
$(foreach bdir,$(BUILD_DIRS),$(eval $(call make-goal,$(bdir))))
-include $(DEPS)
Subscribe to:
Posts (Atom)