mirror of
https://github.com/leozide/leocad
synced 2025-01-17 18:11:42 +01:00
Makefile improvements.
This commit is contained in:
parent
2881fdbbfc
commit
f4e2bcdde4
4 changed files with 48 additions and 51 deletions
50
Makefile
50
Makefile
|
@ -4,62 +4,61 @@ include config.mk
|
|||
### Module directories
|
||||
MODULES := $(OSDIR) common
|
||||
|
||||
### look for include files in
|
||||
### each of the modules
|
||||
### Look for include files in each of the modules
|
||||
CPPFLAGS += $(patsubst %,-I%,$(MODULES)) $(OS)
|
||||
CPPFLAGS += -g
|
||||
|
||||
### extra libraries if required
|
||||
### Extra libraries if required
|
||||
LIBS :=
|
||||
|
||||
### each module will add to this
|
||||
### Each module will add to this
|
||||
SRC :=
|
||||
|
||||
BIN := bin/leocad
|
||||
|
||||
ifeq ($(findstring $(MAKECMDGOALS), help config-help config clean veryclean), )
|
||||
-include $(OSDIR)/config.mk
|
||||
endif
|
||||
|
||||
### include the description for
|
||||
### each module
|
||||
### Include the description for each module
|
||||
include $(patsubst %,%/module.mk,$(MODULES))
|
||||
|
||||
### determine the object files
|
||||
### Determine the object files
|
||||
OBJ := \
|
||||
$(patsubst %.c,%.o,$(filter %.c,$(SRC))) \
|
||||
$(patsubst %.cpp,%.o,$(filter %.cpp,$(SRC)))
|
||||
|
||||
### link the program
|
||||
### Link the program
|
||||
.PHONY: all static
|
||||
|
||||
all: $(BIN)
|
||||
|
||||
static: bin/leocad.static
|
||||
|
||||
bin/leocad: $(OBJ) bin
|
||||
$(CXX) -o $@ $(OBJ) $(LIBS) $(LDFLAGS)
|
||||
bin/leocad: $(OBJ) bin Makefile
|
||||
@echo Linking $@
|
||||
@$(CXX) -o $@ $(OBJ) $(LIBS) $(LDFLAGS)
|
||||
|
||||
bin/leocad.static: $(OBJ) bin
|
||||
bin/leocad.static: $(OBJ) bin Makefile
|
||||
$(CXX) -static -o $@ $(OBJ) $(LIBS) $(LDFLAGS)
|
||||
|
||||
bin:
|
||||
mkdir bin
|
||||
@mkdir bin
|
||||
|
||||
### include the C/C++ include
|
||||
### dependencies
|
||||
ifeq ($(findstring $(MAKECMDGOALS), help config-help config clean veryclean spotless), )
|
||||
### Include the C/C++ include dependencies
|
||||
ifeq ($(findstring $(MAKECMDGOALS), help config-help config clean veryclean), )
|
||||
-include $(OBJ:.o=.d)
|
||||
endif
|
||||
|
||||
### calculate C/C++ include
|
||||
### dependencies
|
||||
%.d: %.c
|
||||
@[ -s $(OSDIR)/config.h ] || $(MAKE) config
|
||||
@$(CC) -MM -MT '$(patsubst %.d,%.o, $@)' $(CFLAGS) $(CPPFLAGS) -w $< > $@
|
||||
### Calculate C/C++ include dependencies
|
||||
%.d: %.cpp $(OSDIR)/config.h $(OSDIR)/config.mk
|
||||
@$(CXX) -MM -MT '$(patsubst %.d,%.o, $@)' $(CXXFLAGS) $(CPPFLAGS) -w $< > $@
|
||||
@[ -s $@ ] || rm -f $@
|
||||
|
||||
%.d: %.cpp
|
||||
@[ -s $(OSDIR)/config.h ] || $(MAKE) config
|
||||
@$(CXX) -MM -MT '$(patsubst %.d,%.o, $@)' $(CXXFLAGS) $(CPPFLAGS) -w $< > $@
|
||||
### Main compiler rule
|
||||
%.o: %.cpp $(OSDIR)/config.h $(OSDIR)/config.mk
|
||||
@echo $<
|
||||
@$(CXX) $(CXXFLAGS) $(CPPFLAGS) -c -o '$(patsubst %.cpp,%.o, $@)' $<
|
||||
@[ -s $@ ] || rm -f $@
|
||||
|
||||
### Various cleaning functions
|
||||
|
@ -71,12 +70,10 @@ clean:
|
|||
veryclean: clean
|
||||
find $(MODULES) -name \*.d | xargs rm -f
|
||||
rm -rf bin
|
||||
|
||||
spotless: veryclean
|
||||
rm -rf arch $(OSDIR)/config.mk $(OSDIR)/config.h
|
||||
|
||||
|
||||
### dependency stuff is done automatically, so these do nothing.
|
||||
### Dependency stuff is done automatically, so these do nothing.
|
||||
.PHONY: dep depend
|
||||
|
||||
|
||||
|
@ -94,7 +91,6 @@ help:
|
|||
@echo ' a -zip or -tgz variants)'
|
||||
@echo ' clean'
|
||||
@echo ' veryclean'
|
||||
@echo ' spotless'
|
||||
@echo
|
||||
|
||||
### Rules to make various packaging
|
||||
|
|
28
config.mk
28
config.mk
|
@ -135,6 +135,9 @@ config-help:
|
|||
CONFTEST="\#include <stdio.h>\nint main() { FILE *f=fopen(\"conftestval\", \"w\");\n\
|
||||
if (!f) return 1; fprintf(f, \"%%d\\\n\", (int)sizeof(%s)); return 0; }\n"
|
||||
|
||||
$(OSDIR)/config.h $(OSDIR)/config.mk:
|
||||
make config
|
||||
|
||||
config:
|
||||
@echo "Automatic configuration"
|
||||
|
||||
|
@ -229,11 +232,6 @@ config:
|
|||
ac_cv_sizeof_void_p=0; \
|
||||
fi; \
|
||||
echo "#define LC_SIZEOF_VOID_P $$ac_cv_sizeof_void_p" >> $(OSDIR)/config.h; \
|
||||
if test "$$ac_cv_sizeof_void_p" -eq "8"; then \
|
||||
echo "#define LC_POINTER_TO_INT(p) ((lcint32)(lcint64)(p))" >> $(OSDIR)/config.h; \
|
||||
else \
|
||||
echo "#define LC_POINTER_TO_INT(p) ((lcint32)(p))" >> $(OSDIR)/config.h; \
|
||||
fi; \
|
||||
rm -f conftest.c conftest conftestval; \
|
||||
\
|
||||
echo -n "checking size of long long... "; \
|
||||
|
@ -260,6 +258,11 @@ config:
|
|||
case 8 in \
|
||||
$$ac_cv_sizeof_long_long) lcint64="long long";; \
|
||||
esac; \
|
||||
if test "$$ac_cv_sizeof_void_p" -eq "8"; then \
|
||||
echo "#define LC_POINTER_TO_INT(p) ((lcint32)(lcint64)(p))" >> $(OSDIR)/config.h; \
|
||||
else \
|
||||
echo "#define LC_POINTER_TO_INT(p) ((lcint32)(p))" >> $(OSDIR)/config.h; \
|
||||
fi; \
|
||||
echo "" >> $(OSDIR)/config.h; \
|
||||
echo "typedef signed char lcint8;" >> $(OSDIR)/config.h; \
|
||||
echo "typedef unsigned char lcuint8;" >> $(OSDIR)/config.h; \
|
||||
|
@ -333,6 +336,21 @@ ifeq ($(TEST_GTK), 1)
|
|||
fi
|
||||
endif
|
||||
|
||||
## Check if the user has OpenGL installed
|
||||
@echo -n "Checking for OpenGL support... "
|
||||
@echo "#include <GL/gl.h>" > gltest.c
|
||||
@echo "int main() { return 0; }" >> gltest.c
|
||||
@if { (eval $(CC) gltest.c -o gltest $(CPPFLAGS) $(LDFLAGS)); } && \
|
||||
(test -s gltest); then \
|
||||
echo "ok"; \
|
||||
else \
|
||||
rm -f gltest.c gltest; \
|
||||
echo "failed"; \
|
||||
rm -rf $(OSDIR)/config.mk $(OSDIR)/config.h; \
|
||||
exit 1; \
|
||||
fi
|
||||
@rm -f gltest.c gltest
|
||||
|
||||
## Check if the user has libjpeg installed
|
||||
@echo -n "Checking for jpeg support... "
|
||||
@echo "char jpeg_read_header();" > jpegtest.c
|
||||
|
|
17
linux/lc
17
linux/lc
|
@ -1,17 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
# set the LeoCAD library path
|
||||
LEOCAD_LIB=/mnt/f/projects/leocad/windows/debug/
|
||||
export LEOCAD_LIB
|
||||
|
||||
# run the program
|
||||
./leocad
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
MAJOR := 0
|
||||
MINOR := 75
|
||||
PATCHLVL := 2
|
||||
MINOR := 76
|
||||
PATCHLVL := 0
|
||||
VERSIONTAG :=
|
||||
VERSION := $(MAJOR).$(MINOR).$(PATCHLVL)
|
||||
|
|
Loading…
Reference in a new issue